diff --git a/apps/docs/pages/guides/auth/passwordless-login/auth-email-otp.mdx b/apps/docs/pages/guides/auth/passwordless-login/auth-email-otp.mdx index 38857d78245..b3843034963 100644 --- a/apps/docs/pages/guides/auth/passwordless-login/auth-email-otp.mdx +++ b/apps/docs/pages/guides/auth/passwordless-login/auth-email-otp.mdx @@ -86,6 +86,15 @@ If the request was successful, you receive a response with `error: null` and a ` ## Verify OTP to create session + + + Provide an input field for the user to key in the one-time code. To verify the code and complete the user's sign in, call [verifyOtp()](/docs/reference/javascript/auth-verifyotp) with their email address, the code, and `type: "email"`: ```js @@ -99,6 +108,18 @@ const { }) ``` + + + +Provide an input field for the user to key in the one-time code. To verify the code and complete the user's sign in, call [verifyEmailOtp()](/docs/reference/kotlin/auth-verifyotp) with their email address, the code, and `OtpType.Email.EMAIL` as the type: + +```kotlin +supabase.auth.verifyEmailOtp(type = OtpType.Email.EMAIL, email = "email", token = "151345") +``` + + + + If successful the user will now be logged in and you should receive a valid session like: ```json diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.yml index a0fb25b02a6..00a385f9bad 100644 --- a/apps/docs/spec/supabase_kt_v2.yml +++ b/apps/docs/spec/supabase_kt_v2.yml @@ -2528,6 +2528,7 @@ functions: - Requires either an email or phone number. - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. - If the user doesn't exist, `signInWith(OTP)` will signup the user instead. To restrict this behavior, you can set `createUser` to `false`. + - The method `signUpWith(OTP)` does the exact same thing as `signInWith(OTP)`, so it doesn't matter which one you use. - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. - If you're using phone, you can configure whether you want the user to receive a OTP. - The magic link's destination URL is determined by the [`SITE_URL`](/docs/reference/auth/config#site_url). @@ -2677,22 +2678,24 @@ functions: title: 'Verify OTPs' $ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp' notes: | - Log in a user given a User supplied OTP received via mobile. + - Verifying an OTP is done through either `verifyPhoneOtp` or `verifyEmailOtp`. + - The verification type used should be determined based on the corresponding auth method called before using `verifyPhoneOtp`/`verifyEmailOtp` to sign up / sign-in a user. examples: - id: verify-email-otp(otp) name: Verify an Email OTP isSpotlight: true code: | ```kotlin - supabase.auth.verifyEmailOtp(type = OtpType.Email.INVITE, email = "example@email.com", token = "token") + supabase.auth.verifyEmailOtp(type = OtpType.Email.EMAIL, email = "example@email.com", token = "token") ``` description: | Available types are: - - `OtpType.Email.MAGIC_LINK` - - `OtpType.Email.SIGNUP` + - `OtpType.Email.MAGIC_LINK` (deprecated) + - `OtpType.Email.SIGNUP` (deprecated) - `OtpType.Email.INVITE` - `OtpType.Email.RECOVERY` - `OtpType.Email.EMAIL_CHANGE` + - `OtpType.Email.EMAIL` - id: verify-phone-otp(otp) name: Verify an Phone OTP isSpotlight: false