Nextjs-auth0: Handle Signup

Created on 8 Oct 2019  Â·  9Comments  Â·  Source: auth0/nextjs-auth0

Description

It seems that using this lib that there is no way to redirect user to signup part of the universal login.

Describe the ideal solution

I would expect a auth0.handleSignup.

I'm maybe missing something but If I'm right I would enjoy open a PR.

Most helpful comment

Try this:
{ authParams: { screen_hint: 'signup' } }

All 9 comments

Hi @matthieuh , here you go: https://github.com/auth0/nextjs-auth0/pull/24 (v0.5.0). You could implement a new API route (eg: /api/signup) which calls the login handler with specific options which will be used by your login page (eg: mode=signup).

Feel free to re-open the issue if this doesn't solve it for you.

Using the login handler with a mode parameter seems not redirecting user to signup screen with the latest lib version (v0.5.0).

await auth0.handleLogin(req, res, {
  authParams: {
    mode: 'signup'
  }
});

Edit: Since it's seems that I cant re-open it I will create a new issue redirecting to this one as history.

I have this working on 0.5.0 by passing the "signUp" value as initialScreen instead of mode:

await auth0.handleLogin(req, res, {
  authParams: {
    initialScreen: 'signUp'
  }
});

I've tried all the options suggested on this issue but I cannot get this working – I land on the sign in view every time. I‘m using the universal login form.

Has anybody managed to get this to work recently?

Try this:
{ authParams: { screen_hint: 'signup' } }

I tried both of these in different configurations:
authParams:{ initialScreen: 'signUp', screen_hint: 'signup' }
And I still ended up with Sign In not Sign Up. So no-go on my end right now!

I'm trying out the approach here using the new universal login: https://community.auth0.com/t/how-do-i-link-users-directly-to-the-hosted-signup-page/42520

auth0.handleLogin(req, res, {
  authParams: {
    prompt: "login",
    screen_hint: "signup",
  },
});

And it's still leading me to the Login and not the Sign Up tab.

Hmm, decided to just jump into my auth0 config and follow https://github.com/auth0/nextjs-auth0/issues/25#issuecomment-649310807 instead

auth0.handleLogin(req, res, {
  authParams: {
    prompt: "signup",
  },
});

This then worked for me.

I have "mode" rather than "prompt" in my handleLogin and it seems to be working.

    const { launch_login } = req.query;

    await auth0.handleLogin(req, res, {
      authParams: {
        mode: launch_login || "signup"
      }
    });
Was this page helpful?
0 / 5 - 0 ratings