Magic link and custom rules are not working correctly

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'] =;
  callback(null, user, context);

It appears that the field is not the same the receiver email. Something like I’m sending an email to “” and after open the link in this email box I got “” in the field. And this “” is always the same (stuck) whenever email address I use to sign in.

Hi @shadeglare,

Welcome to the Auth0 Community!

Just to clarify the problem, you are getting the same exact email in your access token, regardless of the email you use to sign in with a magic link?

A couple more questions; Are you using CUSTOM_NAMESPACE as your namespace, or is that just a placeholder? If you are using a placeholder, could you DM the namespace you are using as well as your tenant name? Also, what stack are you using?


Yes. I’m getting the same exact email. CUSTOM_NAMESPACE is a placeholder here I’m using something like

I’m developing an SPA web application. Indeed everything works fine if I’m using the passwordless auth via sending code by email and have no clue why it’s not working with the magic link method.


Would you DM me your tenant name so I can look into it?