cURL
curl --location 'https://user-auth.otpless.app/auth/v1/validate/token' \
--header 'Content-Type: application/json' \
--header 'clientId: YOUR_CLIENT_ID' \
--header 'clientSecret: YOUR_CLIENT_SECRET' \
--data '{
"token": "RECEIVED_TOKEN_FROM_OTPLESS"
}'import requests
url = "https://user-auth.otpless.app/auth/v1/validate/token"
payload = { "token": "<string>" }
headers = {
"clientId": "<api-key>",
"clientSecret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
clientId: '<api-key>',
clientSecret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({token: '<string>'})
};
fetch('https://user-auth.otpless.app/auth/v1/validate/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://user-auth.otpless.app/auth/v1/validate/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"clientId: <api-key>",
"clientSecret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://user-auth.otpless.app/auth/v1/validate/token"
payload := strings.NewReader("{\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("clientId", "<api-key>")
req.Header.Add("clientSecret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://user-auth.otpless.app/auth/v1/validate/token")
.header("clientId", "<api-key>")
.header("clientSecret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://user-auth.otpless.app/auth/v1/validate/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["clientId"] = '<api-key>'
request["clientSecret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "TOKEN_VALUE",
"status": "SUCCESS",
"userId": "USER_ID",
"timestamp": "2024-10-15T14:07:14Z",
"identities": [
{
"identityType": "MOBILE",
"identityValue": "919999999999",
"channel": "OAUTH",
"methods": [
"TRUE_CALLER"
],
"verified": true,
"verifiedAt": "2024-10-15T14:07:14Z"
}
],
"network": {
"ip": "103.246.62.146",
"timezone": "Asia/Kolkata",
"ipLocation": {
"accuracyRadius": 1000,
"city": {},
"subdivisions": {},
"country": {
"code": "IN",
"name": "India"
},
"continent": {
"code": "AS"
},
"latitude": 21.9974,
"longitude": 79.0011,
"asn": {
"asn": "139570",
"name": "Spectrum Internet Services",
"network": "103.246.62.0/23"
}
}
},
"deviceInfo": {
"userAgent": "Mozilla/5.0 (Linux; Android 14; RMX3998 Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/129.0.6668.100 Mobile Safari/537.36 otplesssdk",
"platform": "Linux aarch64",
"vendor": "Google Inc.",
"browser": "Chrome",
"connection": "4g",
"language": "en-GB",
"cookieEnabled": true,
"screenWidth": 360,
"screenHeight": 800,
"screenColorDepth": 24,
"devicePixelRatio": 3,
"timezoneOffset": -330,
"cpuArchitecture": "8-core",
"fontFamily": "sans-serif",
"deviceId": "DEVICE_ID",
"browserInfo": {
"browserName": "Other",
"os": "Android",
"osVersion": "14",
"device": "Generic Smartphone"
}
},
"secureInfo": {
"incognito": false,
"confidence": {
"score": 1,
"revision": "v1.1"
},
"bot": {
"result": "notDetected"
},
"rootApps": {
"result": false
},
"emulator": {
"result": false
},
"vpn": {
"result": true,
"originCountry": "unknown",
"methods": {
"timezoneMismatch": false,
"publicVPN": true
}
},
"tampering": {
"result": false,
"anomalyScore": 0
},
"jailbroken": {
"result": false
},
"clonedApp": {
"result": false
},
"factoryReset": {
"time": "2024-10-09T10:53:31Z",
"timestamp": 1728471211
},
"frida": {
"result": false
},
"suspectScore": {
"result": 5
},
"privacySettings": {
"result": false
}
}
}{
"message": "Invalid Request",
"errorCode": "7114",
"description": "Request error: Invalid token"
}{
"message": "Expired",
"errorCode": "7301",
"description": "Request error: Token is expired"
}{
"message": "Something went wrong. please try again!!"
}Verify Frontend SDK token
Verify token
Validates user details by exchanging the token obtained from the otplessUser object for the user’s information. This server-to-server call requires authentication using the client ID and secret. Also the secureInfo details will only be included when the Secure SDK is integrated as part of the authentication implementation.
POST
/
auth
/
v1
/
validate
/
token
cURL
curl --location 'https://user-auth.otpless.app/auth/v1/validate/token' \
--header 'Content-Type: application/json' \
--header 'clientId: YOUR_CLIENT_ID' \
--header 'clientSecret: YOUR_CLIENT_SECRET' \
--data '{
"token": "RECEIVED_TOKEN_FROM_OTPLESS"
}'import requests
url = "https://user-auth.otpless.app/auth/v1/validate/token"
payload = { "token": "<string>" }
headers = {
"clientId": "<api-key>",
"clientSecret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
clientId: '<api-key>',
clientSecret: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({token: '<string>'})
};
fetch('https://user-auth.otpless.app/auth/v1/validate/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://user-auth.otpless.app/auth/v1/validate/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"clientId: <api-key>",
"clientSecret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://user-auth.otpless.app/auth/v1/validate/token"
payload := strings.NewReader("{\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("clientId", "<api-key>")
req.Header.Add("clientSecret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://user-auth.otpless.app/auth/v1/validate/token")
.header("clientId", "<api-key>")
.header("clientSecret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://user-auth.otpless.app/auth/v1/validate/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["clientId"] = '<api-key>'
request["clientSecret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "TOKEN_VALUE",
"status": "SUCCESS",
"userId": "USER_ID",
"timestamp": "2024-10-15T14:07:14Z",
"identities": [
{
"identityType": "MOBILE",
"identityValue": "919999999999",
"channel": "OAUTH",
"methods": [
"TRUE_CALLER"
],
"verified": true,
"verifiedAt": "2024-10-15T14:07:14Z"
}
],
"network": {
"ip": "103.246.62.146",
"timezone": "Asia/Kolkata",
"ipLocation": {
"accuracyRadius": 1000,
"city": {},
"subdivisions": {},
"country": {
"code": "IN",
"name": "India"
},
"continent": {
"code": "AS"
},
"latitude": 21.9974,
"longitude": 79.0011,
"asn": {
"asn": "139570",
"name": "Spectrum Internet Services",
"network": "103.246.62.0/23"
}
}
},
"deviceInfo": {
"userAgent": "Mozilla/5.0 (Linux; Android 14; RMX3998 Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/129.0.6668.100 Mobile Safari/537.36 otplesssdk",
"platform": "Linux aarch64",
"vendor": "Google Inc.",
"browser": "Chrome",
"connection": "4g",
"language": "en-GB",
"cookieEnabled": true,
"screenWidth": 360,
"screenHeight": 800,
"screenColorDepth": 24,
"devicePixelRatio": 3,
"timezoneOffset": -330,
"cpuArchitecture": "8-core",
"fontFamily": "sans-serif",
"deviceId": "DEVICE_ID",
"browserInfo": {
"browserName": "Other",
"os": "Android",
"osVersion": "14",
"device": "Generic Smartphone"
}
},
"secureInfo": {
"incognito": false,
"confidence": {
"score": 1,
"revision": "v1.1"
},
"bot": {
"result": "notDetected"
},
"rootApps": {
"result": false
},
"emulator": {
"result": false
},
"vpn": {
"result": true,
"originCountry": "unknown",
"methods": {
"timezoneMismatch": false,
"publicVPN": true
}
},
"tampering": {
"result": false,
"anomalyScore": 0
},
"jailbroken": {
"result": false
},
"clonedApp": {
"result": false
},
"factoryReset": {
"time": "2024-10-09T10:53:31Z",
"timestamp": 1728471211
},
"frida": {
"result": false
},
"suspectScore": {
"result": 5
},
"privacySettings": {
"result": false
}
}
}{
"message": "Invalid Request",
"errorCode": "7114",
"description": "Request error: Invalid token"
}{
"message": "Expired",
"errorCode": "7301",
"description": "Request error: Token is expired"
}{
"message": "Something went wrong. please try again!!"
}Authorizations
The clientId used for API authentication.
The clientSecret used for API authentication.
Body
application/json
Payload containing the token received from otpless authentication for verification.
Token received from otplessUser object.
Response
The user's information was successfully retrieved.
Example:
"TOKEN_VALUE"
Example:
"SUCCESS"
Example:
"USER_ID"
Example:
"2024-10-15T14:07:14Z"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I