Authenticate Your UsersPhone OTP

Authenticate User via Phone OTP

Learn how to authenticate users via Phone OTP with the Okto SDK.

Methods Overview

MethodsDescription
async sendPhoneOTP(phoneNumber, countryShortName)Send an OTP to the user's email
async verifyPhoneOTP(phoneNumber, countryShortName, otp, token)Verify the OTP sent to the user's email

Send Phone OTP

sendPhoneOTP(phoneNumber, countryShortName) sends an OTP to the specified phone number.

Parameters

ParameterTypeDescription
phoneNumberstringThe user's phone number
countryShortNamestringThe country (e.g., 'US', 'IN')

Response

Success Response

Field NameTypeDescription
statusstringThe status of the request
tokenstringA token to be used for OTP verification

Verify Phone OTP

verifyPhoneOTP(phoneNumber, countryShortName, otp, token) verifies the OTP sent to the user's phone number.

Parameters

ParameterTypeDescription
phoneNumberstringThe user's phone number
countryShortNamestringThe country (e.g., 'US', 'IN')
otpstringThe OTP received by the user
tokenstringThe token received from sendPhoneOTP

Response

Success Response

Field NameTypeDescriptionPossible Values
resultbooleanResults true if OTP verification is successfultrue, false

On this page