Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication: Expose the Netlify Identity Widget's 'signup' functionality #963

Closed
cannikin opened this issue Aug 13, 2020 · 8 comments · Fixed by #1057
Closed

Authentication: Expose the Netlify Identity Widget's 'signup' functionality #963

cannikin opened this issue Aug 13, 2020 · 8 comments · Fixed by #1057
Assignees
Projects

Comments

@cannikin
Copy link
Member

redwoodjs/repeater-issues#2

@peterp
Copy link
Contributor

peterp commented Aug 14, 2020

We can append it to this PR: #783

@mojombo mojombo added this to v1.0 in Auth Aug 18, 2020
@dthyresson
Copy link
Contributor

Since login can accept options, could login({signup: true}) instead invoke open('signup') instead?

https://github.com/redwoodjs/redwood/blob/main/packages/auth/src/authClients/netlify.ts#L14

  login: () => {
      return new Promise((resolve, reject) => {
        let autoClosedModal = false
        client.open('login')
        client.on('login', (user) => {
          // This closes the modal which pops-up immediately after you login.
          autoClosedModal = true
          client.close()
          return resolve(user)
        })
        client.on('close', () => {
          !autoClosedModal && resolve(null)
        })
        client.on('error', reject)
      })
    },

Instead of adding a new "signup" to the AuthProvider?

@cannikin
Copy link
Member Author

Hmmm for Netlify maybe, since Sign Up and Log In are sort of just two views of the same widget, but other providers might have a totally different flow. Seems like they should both get a top-level function to me.

@dthyresson
Copy link
Contributor

dthyresson commented Aug 20, 2020

@peterp Same as #783.

Should we reuse login or define a new top level signup?

Assume that signup by default will just invoke login for those that don't have provider-specific logic (like with Auth0 universal login not certain the signup tab can be selected by default).

@cannikin
Copy link
Member Author

Is it weird to only have those providers that support a signup flow actually expose a signup function that you can destructure from useAuth()? Not sure if that's expected in JS world. Or maybe they all expose signup but if you actually call it from a provider that doesn't support it you just get a noop and a console message saying it isn't supported?

It feels weird to me to have a function signup that doesn't sign you up, just takes you to login. But maybe that's just me? @mojombo?

@dthyresson dthyresson self-assigned this Aug 26, 2020
@dthyresson
Copy link
Contributor

Auth0 supports defaulting to Sign Up as well as Netlify.

See: https://auth0.com/docs/universal-login/new-experience

You can make users land directly on the Signup page instead of the Login page by specifying the screen_hint=signup parameter when redirecting to /authorize. Note that this can be combined with prompt=login, which indicates whether you want to always show the authentication page or you want to skip if there's an existing session.

Screen Shot 2020-08-25 at 21 37 27

Also example here:

https://community.auth0.com/t/how-do-i-link-users-directly-to-the-hosted-signup-page/42520

Note: probably want to support the "New" Universal vs "Classic" Universal.

@peterp and @cannikin Can we decide if

  • add signup()
  • add options to login() like {signup: true} or {show: 'signup'}

I think I would prefer to have an explicit signup() because I won't remember the options.

The auth client itself would implement. It might just call login with some extract params.

@dthyresson
Copy link
Contributor

Also see issue: #725 to document login/logout options.

@peterp
Copy link
Contributor

peterp commented Aug 26, 2020

My vote is for a signUp function, so that it feels like it matches our current logIn and logOut functions.

@dthyresson dthyresson moved this from v1.0 to In progress in Auth Sep 3, 2020
Auth automation moved this from In progress to Done Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Auth
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants