Hi, I am using Universal login and need to access email and username.
I have Requires UserName selected in Connections > Database.
I have setup the following rule:
function addAttributes(user, context, callback) {
context.accessToken["http://soundcla.sh/user/nickname"] = user.nickname;
context.accessToken["http://soundcla.sh/user/name"] = user.name;
context.accessToken["http://soundcla.sh/user/email"] = user.email;
callback(null, user, context);
}
And it works when I debug using “TRY THIS RULE”.
However, when I sign up as a new user it behaves inexplicably:
given values of jonnydoe@mailinator.com
and "jdoe"
the user object I get from useAuth0 is thus:
{
nickname: "jonnydoe",
name: "jonnydoe@mailinator.com",
email: "jonnydoe@mailinator.com",
}
When I review the user created in the database it uses different labels altogether but the rawJSON shows me that the name I entered on sign up has been assigned to
"username": "jdoe"
By adding user.username to the rule I can get the username but it still doesn’t show in the user object that is returned from useAuth0 in the npm package.
It is extremely confusing. There seems to be a gap between Universal Login config and the spa library?