Check OTP
POST /checkOTP
Request Body
{
"otp_code" : 447289,
"account_id" : "6451673",
"type" : 2,
"hash" : "fccfafc3eb879d9306edcf548cc3d8f7c2ea833d5d8f1a2110969ce138bf9ec3"
}
Description
| Name | Description |
|---|---|
| otp_code | OTP code that user received |
| account_id | Account ID from generated otp |
| type | 1 for token to check hash , 2 for non hashing |
| hash | Hash value for request |
Hash
- PHP
- NodeJs
- TypeScript
$strValue = $otp_code.$account_id;
$hashValue = hash_hmac('sha256', $strValue, $app_secret);
const crypto = require('crypto');
const otpCode = '123456'; // Replace with the actual phone number
const accountId = '12321'; // Replace with the actual app secret
const strValue = otpCode + accountId;
const hashValue = crypto.createHmac('sha256', appSecret).update(strValue).digest('hex');
import crypto from 'crypto';
const otpCode: string = '123456'; // Replace with the actual phone number
const accountId: string = '12321'; // Replace with the actual app ID
const strValue: string = otpCode + accountId;
const hashValue: string = crypto.createHmac('sha256', appSecret).update(strValue).digest('hex');
Response Type 1
{
"error": false,
"token": "8d52c2ea7a126396c6df8566e3081aa33f30901699943180bbffd42da189b6c5",
"hash": "396da26aaa85e90c30a1d3abe7c9190d75c595d31a52ef2d90e1c4068e130f4c",
"phone": {
"number": "+959974274616",
"country_prefix": "95",
"national_number": "9974274616"
},
"expire_time": 1714498494
}
To check hash value use with token
$hashValue = hash_hmac('sha256', $token, $secretKey); //To confirm
Response Type 2
{
"error": false,
"created_at": 1711820011,
"phone": {
"number": "+959974274616",
"country_prefix": "95",
"national_number": "9974274616"
},
"application": {
"id": "974658516625303"
}
}