Auth0.js: How to redirect users to SignUp page directly ?

Created on 2 May 2019  路  6Comments  路  Source: auth0/auth0.js

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

Most helpful comment

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?

All 6 comments

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?

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

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

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.

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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sergew92 picture sergew92  路  3Comments

beno picture beno  路  3Comments

edmorley picture edmorley  路  6Comments

NathHorrigan picture NathHorrigan  路  6Comments

StefH picture StefH  路  5Comments