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

Add the ability to enable the shouldCreateUser on passwordless login #262

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

albertocubeddu
Copy link

What kind of change does this PR introduce?

  • Update the requirements to use the latest pnpm.
  • Ability to pass "additionalData" to the <MagicLink>.
  • Implement the logic for <MagicLink> when "additionalData" is provided (as it's optional).

What is the current behavior?

You're not able to provide any additional data, therefore you can't decide if you want to create users when a customer uses OTP.

What is the new behavior?

Passing the proper option, you'll be able to decide if you want to have shouldCreateUser

 <Auth
    supabaseClient={supabase}
    additionalData={{ shouldCreateUser: false }}
    view={view.id}

Furthermore, we're using the SignInWithPasswordlessCredentials and we are adding the ability to pass data too

const signInOptions: SignInWithPasswordlessCredentials = {
      email,
      options: {
        emailRedirectTo: redirectTo,
        data: restData,
        ...(shouldCreateUser !== undefined && { shouldCreateUser }),

Additional context

I've decided to re-use the additionalData, as it's used on another component, and it seems to continue with the logic of the original author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant