Kotlin: Sign in a user through OTP Sends a OTP to the user's email or phone number.
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, sendOtpTo()
will signup the user instead. To restrict this behavior, you can set createUser
to false
.
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
.
See redirect URLs and wildcards to add additional redirect URLs to your project.
To learn how to handle OTP links & OAuth refer to initializing
Magic links and OTPs share the same implementation. To send users a one-time code instead of a magic link, modify the magic link email template to include \{\{ .Token \}\}
instead of \{\{ .ConfirmationURL \}\}
.
Examples Sign in with email supabase.gotrue.sendOtpTo(Email) \{
email = "example@email.com"
\}
Sign in with SMS OTP supabase.gotrue.sendOtpTo(Phone) \{
phoneNumber = "+4912345679"
\}