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

fix: add shouldCreateUser field to sign in with magiclink #199

Merged
merged 4 commits into from
Feb 24, 2022

Conversation

kangmingtay
Copy link
Member

@kangmingtay kangmingtay commented Dec 28, 2021

What kind of change does this PR introduce?

@kangmingtay
Copy link
Member Author

kangmingtay commented Dec 28, 2021

Just wondering if it will be confusing to name the param noSignup inside the signIn method since noSignup only affects magiclinks or otps. IMO i think it might be confusing if developers expect it to apply to all types of sign-in methods including the signing in with an external oauth provider.

Would a more explicit name such as noOtpSignup be clearer?

Decided to go with adding a shouldCreateUser option to the signIn method. The only concern i have is the shouldCreateUser option only applies to magiclink sign-ins. I wonder if this makes the DX confusing for devs using the signIn method for other types of sign-in (e.g social providers / password-based).

@kangmingtay kangmingtay changed the title [WIP] fix: add noSignup field to signIn fix: add shouldCreateUser field to sign in with magiclink Feb 18, 2022
Copy link
Member

@thorwebdev thorwebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit regarding typedoc comment.

@@ -190,6 +190,7 @@ export default class GoTrueClient {
{ email, phone, password, refreshToken, provider, oidc }: UserCredentials,
options: {
redirectTo?: string
shouldCreateUser?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to the @param comments above for the docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, yeah i think this would also help to make it clear that the shouldCreateUser flag can only be used for magiclinks / otp sign-ins

@kangmingtay kangmingtay merged commit 12d02c3 into master Feb 24, 2022
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.22.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kristjanmar
Copy link

This is not working, unfortunately. The user gets added when typing an email into the login form even when the flag is activated.

async function signIn(email: string) {
	const { error } = await supabase.auth.signIn({
		email,
		shouldCreateUser: false
	})
	return { error }
}

I've tried shouldCreateUser, create_user and noSignup as the flag, since it is unclear which one it's supposed to be. But none of them work.

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

Successfully merging this pull request may close these issues.

auth.signIn() with magic link creates users in Auth.users table
3 participants