Skip to content

Commit

Permalink
feat: Add token hash to verifyOtp (#813)
Browse files Browse the repository at this point in the history
* feat: add token hash to verifyOtp

* style: format
  • Loading branch information
Vinzent03 authored Jan 30, 2024
1 parent 9b05eea commit a789d79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/gotrue/lib/src/gotrue_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,16 @@ class GoTrueClient {
/// [phone] is the user's phone number WITH international prefix
///
/// [token] is the token that user was sent to their mobile phone
///
/// [tokenHash] is the token used in an email link
Future<AuthResponse> verifyOTP({
String? email,
String? phone,
required String token,
required OtpType type,
String? redirectTo,
String? captchaToken,
String? tokenHash,
}) async {
assert((email != null && phone == null) || (email == null && phone != null),
'`email` or `phone` needs to be specified.');
Expand All @@ -501,6 +504,7 @@ class GoTrueClient {
'type': type.snakeCase,
'redirect_to': redirectTo,
'gotrue_meta_security': {'captchaToken': captchaToken},
if (tokenHash != null) 'token_hash': tokenHash,
};
final fetchOptions = GotrueRequestOptions(headers: _headers, body: body);
final response = await _fetch
Expand Down

0 comments on commit a789d79

Please sign in to comment.