I’m using the passwordless magic link for signing in but have a problem with implementing a custom rule in js.
After opening a magic link and parsing it’s hash via the parseHash function the auth0 backend can’t add the correct user email to my access token.
Rule code snippet:
function (user, context, callback) {
const namespace = 'CUSTOM_NAMESPACE';
context.accessToken[namespace + 'email'] = user.email;
console.log(user);
callback(null, user, context);
}
It appears that the user.email field is not the same the receiver email. Something like I’m sending an email to “foo@mail.com” and after open the link in this email box I got “bar@mail.com” in the user.email field. And this “bar@mail.com” is always the same (stuck) whenever email address I use to sign in.