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

signInWithOtp does not return OTP type, making it unclear whether to use sign-up confirmation or magic link flow #1078

Open
bennajah0 opened this issue Nov 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bennajah0
Copy link

Describe the bug
The signInWithOtp method does not return any indication of which OTP type (sign-up confirmation or magic link) was sent. This makes it unclear which flow to follow in the verifyOtp method, as the OTP type depends on whether the user's email is verified.

To Reproduce
Steps to reproduce the behavior:

  1. Call signInWithOtp with an email that may or may not be verified.
  2. Observe that the method returns null, with no indication of whether a sign-up confirmation or a magic link email was sent.

Expected behavior
I expect signInWithOtp to return an indicator of the OTP type (e.g.,the email is verified, sign-up confirmation or magic link) so that I can handle the appropriate verification flow in the verifyOtp method.

Screenshots
If applicable, add screenshots to help explain your problem.

Version (please complete the following information):
supabase_flutter 2.8.0
supabase 2.5.0
functions_client 2.4.0
gotrue 2.10.0
postgrest 2.3.0
realtime_client 2.4.0
storage_client 2.2.0

Additional context
This enhancement would allow developers to handle OTP verification flows more accurately by knowing which type of OTP was sent.

@bennajah0 bennajah0 added the bug Something isn't working label Nov 4, 2024
@khalidouaadou1
Copy link

The SignInWithOtp method can be used for both sign-in and sign-up, while verifyOtp handles the OTP verification for SignInWithOtp.

This approach supports different OtpType values:

OtpType.signup: for cases where the email does not exist or is unverified.

OtpType.magiclink: for cases where the email is already verified.

Because of this, it’s not always clear if SignInWithOtp is being used for sign-in or sign-up.

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

2 participants