Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

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

Merged
kangmingtay merged 4 commits into
masterfrom
km/use-otp-endpoint
Feb 24, 2022
Merged

kangmingtay merged 4 commits into
masterfrom
km/use-otp-endpoint

Conversation

@kangmingtay

@kangmingtay kangmingtay commented Dec 28, 2021 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

@kangmingtay

kangmingtay commented Dec 28, 2021 •

Copy link
Copy Markdown
Member Author

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

@thorwebdev thorwebdev left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/GoTrueClient.ts
{ email, phone, password, refreshToken, provider, oidc }: UserCredentials,
options: {
redirectTo?: string
shouldCreateUser?: boolean

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

🎉 This PR is included in version 1.22.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kristjanmar

Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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