Skip to content

Wrong parameter assertions in verifyOTP #1159

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

Open
maxfornacon opened this issue Apr 22, 2025 · 0 comments
Open

Wrong parameter assertions in verifyOTP #1159

maxfornacon opened this issue Apr 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@maxfornacon
Copy link

maxfornacon commented Apr 22, 2025

Describe the bug
The verifyOTP method requires to always have either email or phone to be not null. When trying to use the the method with OtpType.recovery and specifying an email I receive AuthException(message: Only the token_hash and type should be provided, statusCode: 400, errorCode: validation_failed).

My workaround is to specify an empty string for email.

To Reproduce
Steps to reproduce the behavior:

This doesn't work with exception from backend.

await Supabase.instance.client.auth.verifyOTP(
        email: email,
        tokenHash: token,
        type: OtpType.recovery,
      );

Exception:

AuthException(message: Only the token_hash and type should be provided, statusCode: 400, errorCode: validation_failed)

This doesn't work with exception from supabase flutter client:

await Supabase.instance.client.auth.verifyOTP(
        tokenHash: token,
        type: OtpType.recovery,
      );
Unhandled Exception: 'package:gotrue/src/gotrue_client.dart': Failed assertion: line 536 pos 12: '(email != null && phone == null) || (email == null && phone != null)': `email` or `phone` needs to be specified.

Expected behavior
Correct checking of which OtpType requires which parameters.

@maxfornacon maxfornacon added the bug Something isn't working label Apr 22, 2025
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