I want to use the Hooks Pre User Registration feature to add metadata to both user_metadata and app_metadata.
I’m using SPA flow with loginWithRedirect to sign up a new user using New Universal Login without a custom form. Using @auth0/auth0-spa-js library.
Here’s the client side code:
loginWithRedirect({
redirect_uri: 'http://localhost:3000/hi',
screen_hint: 'signup',
user_metadata: {
birthday: '22-03-1980',
},
app_metadata: {
some_id: 12345,
},
})
Is there a way to pass data up from loginWithRedirect that may be accessible from the hook?
module.exports = function (user, context, cb) {
var response = {};
response.user = user;
// How can I get data from the New Universal Login sign up form called with loginWithRedirect
// from the @auth0/auth0-spa-js library?
// Add user or app metadata to the newly created user
response.user.user_metadata = { foo: 'bar' };
response.user.app_metadata = { vip: true, score: 7 };
cb(null, response);
};