Hi there,
We’re attempting to add extra user_metadata
to our user’s on signup. This extra variable is something that gets passed into our hosted login page in the extraParams
object. We’re able to add this to user’s quite easily when they signup with email+password but are really struggling when it comes to social signin with Google. We have the following code which I thought would do the trick:
function loginWithGoogle() {
webAuth.authorize(
{
connection: 'google-oauth2',
},
function (err, authResult) {
webAuth.parseHash(
{ hash: window.location.hash },
function (err, authResult) {
let idToken = authResult.idToken;
if (err) {
return console.log(err);
}
webAuth.client.userInfo(token, function (err, user) {
var auth0Manage = new auth0.Management({
domain: 'DOMAIN',
token: idToken,
});
let metaData = { referralCode: '1234' };
auth0Manage.patchUserMetadata(
user.sub,
metaData,
function (err, user) {
console.log(err);
});
});
});
});
}
This unfortunately doesn’t seem to work. How can I go about achieving adding user_metadata
to a Google user on signup on the hosted page? Any help would be greatly appreciated.