auth0.js icon indicating copy to clipboard operation
auth0.js copied to clipboard

How to redirect users to SignUp page directly ?

Open rfrerebe opened this issue 7 years ago • 6 comments

Description

I would like to redirect my users to a signup page directly.

Prerequisites

[X] I have checked the documentation for this library.

[X] I have checked the Auth0 Community for related posts.

[X] I have checked for related or duplicate Issues and PRs.

[X] I have read the Auth0 general contribution guidelines.

[X] I have read the Auth0 Code of Conduct.

Environment

Please provide the following:

  • Version of Auth0.js used: 9.10.2
  • Browser and OS version(s) affected: Chrome + Windows 10
  • Additional libraries or browser extensions being used that might affect behavior: None

Reproduction

When I want my users to login, I simply call auth.authorize() like below :

const` auth = new auth0.WebAuth({
  clientID: '...',
  domain: '...'
});

// Show the sign-up screen
auth.authorize();

I found a recent comment describing this possiblity : https://github.com/auth0/auth0.js/issues/311#issuecomment-483327124

passing an additional mode argurment with signUp value

const` auth = new auth0.WebAuth({
  clientID: '...',
  domain: '...'
});

// Show the sign-up screen
auth.authorize({ mode: 'signUp' });

However using this parameter, users will get redirected to the standard login page instead of signup. In Chrome console I have this information

Following parameters are not allowed on the `/authorize` endpoint: [mode]

I would like to know what is the recommanded way to redirect users to signup page directly

Thanks

rfrerebe avatar May 02 '19 13:05 rfrerebe

I would like to know that as well. This API is also shown in the TypeScript typings but it just does not work.

Is this implemented or not?

The same API is mentioned here https://community.auth0.com/t/how-to-redirect-user-to-hosted-signup-page/9482

But only for hosted login pages? If I host my login page myself, I could just use .signUp() method, or am I missing something?

ghost avatar May 08 '19 14:05 ghost

This doesn't seem to be possible in the universal login form even.

Adding a mode=signUp parameter doesn't consistently work on reload.

Flaque avatar May 14 '19 03:05 Flaque

The mode option is not something that is supported OOTB. If you go back to the community post you mentioned, it's a two-step task. You have to update your Universal Login Page template to change the initialScreen parameter based on the mode parameter you sent.

luisrudge avatar May 21 '19 15:05 luisrudge

Currently, it is not possible to add additional parameters to the authentification url, like e.g. display=popup mentiond here: https://auth0.com/docs/api/authentication?javascript#social, am I right? I would like to propose support for this, i.e. allow to add some extraParams to the WebAuth config object.

If this would be available, one could send a parameter to change the initialScreen or deactivate, for example, the registration on the Univeral Login Page.

coperator avatar Jul 10 '19 13:07 coperator

Ah, I just found out at that, indeed, it is possible to add arbitrary params in the WebAuth.authorize function, but not in the WebAuth constructor. So, auth.authorize({ mode: 'signUp' }); mentioned above and in #311 is possible! On problem is, that the parameter list in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/cbdce7fb10d4396810a6068767da25eb80c33623/types/auth0-js/index.d.ts#L821 is fixed.

For Typescript is would be cleaner to consolidate arbitrary params in an extraParams key. So I stay with my proposal above.

coperator avatar Jul 10 '19 13:07 coperator

Would be good for auth0 to pay more attention to issues like this. A prominent podcaster building a product with great traction and visibility decided not to use auth0 because of this issue!!

https://twitter.com/mattwensing/status/1265962167179923457

etewiah avatar May 28 '20 12:05 etewiah