How to redirect to a new page within a rule?

Here is the scenario: New users who signup will be redirected to a signup form to collect additional info. After they submit that, they are redirected to the dashboard. Currently, I have it set up so that once the user logins, the redirectUri for auth0 is set to the signup form. However, I need to change this so that only first time users will be redirected to that form.

I am planning to use rules to implement this, and have read some of the documentation. However, I am confused. So far, I have set up context.redirect url.

The url I wish to redirect to is: http://localhost:3000/signup. However, Auth0 adds a state parameter field to the url, and this messes up the page and doesn’t load it properly. How do I fix this?

Hey there!

Here’s our doc on how to redirect users using rules:

Hi Konrad, I have already read this doc as stated in my message, but I am confused about what the state parameter does in the url and how to deal with that?

Gotchya!

  • Here’s more on state:
  • and here on redirecting users with state parameters:

Okay thank you for the article. After reading it, I’m not so sure I need a rule to do this, since this seems much more complex.

My workflow is this. The user clicks sign up (on the auth0 signup form) → auth0 authenticates the user using IdP → the user is now sent back to my application.

However, depending on whether the user is new or not, they will be redirected to a different page within my application. If they are new, they will be sent to a signup form. If not, they are sent to the regular dashboard.

I can easily implement this in React by using react-router. However, the key information I need is if the user is new or not. Currently, the only way I can think of doing this is by using context.stats.loginscount, and thus I have resorted to using it in a rule. Do I need a rule or is there another way?

I would say the approach you mentioned is the best way as one of our employees also recommended that method here:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.