Can't include a hash in a rule's redirect url

I’m trying to incorporate a custom multi-factor authentication provider into the rules pipeline. If the user I am trying to authenticate requires an MFA code validation, I attempt to redirect them to a URL in the following format:

https://a.b.website.com/#/mfa/verify?token=URL_SAFE_TOKEN&state=AUTH0_STATE

I’m trying to accomplish this by ending my rule with the following snippet:

  context.redirect = {
    url: "https:/a.b.website.com/#/mfa/verify?token=" + token
  };
 return callback(null, user, context);

However, this ends up redirecting me to https://a.b.website.com/?state=AUTH0_STATE#/mfa/verify?token=URL_SAFE_TOKEN.

I removed the # from the redirect URL by ending my rule with the following snippet:

  context.redirect = {
    url: "https:/a.b.website.com/mfa/verify?token=" + token
  };
 return callback(null, user, context);

This ends up redirecting me to a sane URL, https://a.b.website.com/mfa/verify?token=URL_SAFE_TOKEN&state=AUTH0_STATE, but this isn’t viable for me.

Am I missing another way to include a # in the redirect URL or is it not possible at this time?

Can you help me understand in your code why you need a # in the redirect URL?

The goal is to redirect to an angular app that already has a # in the URL for routing.

1 Like

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?