Signup Link - link straight to signup

Hi,

I am trying to get a link that would guide users straight to the “Sign Up” instead of “Log in”. The problem I am running into is that each signup link has a (what appears to be) unique “state” value. Here is an example:
https://login.gigasheet.com/u/signup?state=hKFo2SBPc2kzLThaVkJ4X2xWQlNVSHFPbkpFR0ZfZWhvTUJhZqFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIE9XWnhWaURDOEVlaDI2MENRUkhCLVVSUmNsR1B6ZGowo2NpZNkgWUF5SDJkRDkxbHlKMTRoV3FJV0hkMEZXYlhxQTZWU3A

Is there a way to somehow standardize this value, or ensure it is the same every time?

Hi @ian.kennedy,

Thanks for reaching out to the Auth0 Community!

I understand that you would like to generate a URL that brings your users to your sign-up page instead of the login page.

To do so, you will need to use the New Universal Login Experience and specify the screen_hint=signup query parameter.

For example:

https://YOUR_DOMAIN/authorize?
    response_type=code&
    client_id=YOUR_CLIENT_ID&
    redirect_uri=https://YOUR_APP/callback&
    scope=SCOPE&
    state=STATE&
    screen_hint=signup

See here to learn more.

Please let me know if you have any questions.

Thank you.

1 Like

How would I do this with passport-auth? (NodeJs/Express)

@rueben.tiow
i use nuxtjs then i try to get the url signup with function:

this.$auth.loginWith('auth0', { params: { action: 'signup', screen_hint: 'signup'} })

it still generate path login:

https://xxxx.us.auth0.com/login?state=xxx&client=xxx&protocol=oauth2&response_type=token&access_type=&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Flogin&scope=openid%20profile%20email&code_challenge_method=&action=signup&screen_hint=signup&audience=https%3A%2F%2Fdev-92n2q07b.us.auth0.com%2Fapi%2Fv2%2F&nonce=I2Ecpk1VZg)
1 Like

Hi @hieunk,

Thank you for reaching out about this issue and my apologies for the late reply.

After looking into your tenant, I noticed that you selected the New Universal Login Experience but also toggled on the Customize Login Page setting. When this setting is enabled, it will override the New Universal Login Experience with the Classic Universal Login Experience.

If you prefer to directly send your users to the signup page using the screen_hint=signup query parameter, you must make sure that you are using the New Univeral Login experience, which includes turning off the Customize Login page toggle.

I hope this helps!

Please let me know if I can help with anything else.

Thanks,
Rueben

If you want a signup link using Express and auth0/express-openid-connect: An Express.js middleware to protect OpenID Connect web applications., here’s how to implement it:

app.get("/signup", (req, res) => {
  res.oidc.login({
    returnTo: "/",
    authorizationParams: { screen_hint: "signup" },
  });
});

Cf How to link directly to Sign-Up · Issue #83 · auth0/express-openid-connect · GitHub

1 Like

Thanks, the hint signup does the trick, but the “state” value now needs to be dealt with explicitly. What event can I map to in c# to take care of this? Otherwise, invalid state error is shown although all the user bits did work and you can then login successfully.

Here’s a tip that Auth0 doesn’t appear to mention in their docs: Your client application must not be associated with more than one authentication database.

I could not get a link that would redirect to the signup page until I turned the client app off on every database but one.

Hi @brian-allemana,

Well, it should also be possible to specify the connection authorization parameter to induce login for a specific connection.

For example:

authorizationParams: { 
    screen_hint: "signup",
    connection: "Username-Password-Authentication" 
} 

You can verify that it works by passing those query parameters to your login endpoint in the browser:

https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={https://yourApp/callback}&
    scope={scope}&
    audience={apiAudience}&
    state={state}&
    connection=Username-Password-Authentication&
    screen_hint=signup

I tested this and can confirm that it works.

Let me know if you have any issues with this.

Cheers,
Rueben

Thanks Reuben. I did discover that specifying a db connection in the authorize params allowed the signup redirect to work.

What seems to be the case is that if the client is associated to one db, then not specifying the connection allows redirect to signup with the option to sign in via Social connection. But if you specify the db connection then Social is not an option.

So that means, for redirect to signup to work, the client must be associated with no more than one db connection, or redirect to signup cannot include other connection types.

Is that a correct understanding?

Hi Rueben! How would one specify a signup vs login link using the Classic Universal login?

Hi @brian-allemana,

That’s correct. If you specify a DB connection in your login request, then that would be the only connection the user is allowed to authenticate against. This means that Social connection options are not available.

Conversely, if you omit the connection parameter in the login request and have more than 1 connection enabled for the client, then it will present all connection types available for them to choose to login.

I hope this explanation is clear!

Cheers,
Rueben

Hi @mscroggin,

You can specify the signup screen on the Classic Universal Login experience by using the initialScreen option.

Please refer to our How do I redirect users directly to the hosted signup page? knowledge solution for more details.

Cheers,
Rueben