Authenticate Your UsersPhone OTP
Authenticate User via Phone OTP
Learn how to authenticate users via Phone OTP with the Okto SDK.
Methods Overview
Methods | Description |
---|---|
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 user's phone number.
Parameters
Parameter | Type | Description |
---|---|---|
phoneNumber | string | The user's phone number |
countryShortName | string | The country (e.g., 'US', 'IN') |
Response
Success Response
Field Name | Type | Description |
---|---|---|
status | string | The status of the request |
token | string | A 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
Parameter | Type | Description |
---|---|---|
phoneNumber | string | The user's phone number |
countryShortName | string | The country (e.g., 'US', 'IN') |
otp | string | The OTP received by the user |
token | string | The token received from sendPhoneOTP |
Response
Success Response
Field Name | Type | Description | Possible Values |
---|---|---|---|
result | boolean | Results true if OTP verification is successful | true , false |