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

Can't link email to anonymous user for OTP auth #1112

Closed
willsmanley opened this issue Jan 23, 2025 · 1 comment
Closed

Can't link email to anonymous user for OTP auth #1112

willsmanley opened this issue Jan 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@willsmanley
Copy link

OTP email verification is impossible to add for anonymous users. If you add an email it works as expected, but when you validate it, it always creates a new user with that email identity rather than attaching it to the anonymous user. Again, it will be orphaned.

For more context please review: #1111

@willsmanley willsmanley added the bug Something isn't working label Jan 23, 2025
@willsmanley
Copy link
Author

Solved: instead of signInWithOtp you want to use:

await Supabase.instance.client.auth.updateUser(
   UserAttributes(email: 'someemail@email.com'),
);

signInWithOtp will actually make a new auth.users row instead of attaching an identity to the currently signed in anonymous user. This is a bit confusing and could be documented better, but updateUser definitely works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant