API Documentation
Sign In APIs
- Sign In with OTP
- Sign In with Magic Link
- Sign In with OTP Link
- Sign In with OAuth
- Sign In with Phone Call Approval
Messaging
- WhatsApp
Session Management APIs
Verify Frontend SDK token
Verify Code
This endpoint validates the code received via a Magic link / OAuth request to complete user authentication.
curl --request POST \
--url https://auth.otpless.app/auth/v1/verify/code \
--header 'Content-Type: application/json' \
--header 'clientId: <api-key>' \
--header 'clientSecret: <api-key>' \
--data '{
"code": "CODE"
}'
{
"requestId": "unique_request_id",
"message": "Code verified successfully",
"userDetails": {
"token": "tokenvalue",
"status": "SUCCESS",
"completedAt": 1724276345786,
"identities": [
{
"identityType": "MOBILE/EMAIL",
"identityValue": "IdentityValue",
"channel": "MAGIC_LINK",
"methods": [
"WHATSAPP/SMS/VIBER/EMAIL"
],
"verified": true,
"verifiedTimestamp": 1724276345786
}
],
"network": {
"ip": "192.168.0.1"
},
"deviceInfo": {
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
"platform": "MacIntel",
"vendor": "Google Inc.",
"language": "en-GB",
"cookieEnabled": true,
"screenWidth": 1512,
"screenHeight": 982,
"screenColorDepth": 30,
"devicePixelRatio": 2
}
}
}
Suppose you specify https://example.com/login as the Redirect URI in authorize endpoint. After the user clicks the Magic Link received to his Mobile or Email, they will be redirected to:
https://example.com/login?code=1234abcd
Here, 1234abcd represents the authorization code.
Body
The code to be verified.
"CODE"
Response
The unique identifier for the code verification request.
"unique_request_id"
A message indicating the result of the verification.
"Code verified successfully"
"tokenvalue"
"SUCCESS"
1724276345786
"MOBILE/EMAIL"
"IdentityValue"
"MAGIC_LINK"
true
1724276345786
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
"MacIntel"
"Google Inc."
"en-GB"
true
1512
982
30
2
Was this page helpful?
curl --request POST \
--url https://auth.otpless.app/auth/v1/verify/code \
--header 'Content-Type: application/json' \
--header 'clientId: <api-key>' \
--header 'clientSecret: <api-key>' \
--data '{
"code": "CODE"
}'
{
"requestId": "unique_request_id",
"message": "Code verified successfully",
"userDetails": {
"token": "tokenvalue",
"status": "SUCCESS",
"completedAt": 1724276345786,
"identities": [
{
"identityType": "MOBILE/EMAIL",
"identityValue": "IdentityValue",
"channel": "MAGIC_LINK",
"methods": [
"WHATSAPP/SMS/VIBER/EMAIL"
],
"verified": true,
"verifiedTimestamp": 1724276345786
}
],
"network": {
"ip": "192.168.0.1"
},
"deviceInfo": {
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
"platform": "MacIntel",
"vendor": "Google Inc.",
"language": "en-GB",
"cookieEnabled": true,
"screenWidth": 1512,
"screenHeight": 982,
"screenColorDepth": 30,
"devicePixelRatio": 2
}
}
}