Validate
Validate the OTP received in WhatsApp, follow the next steps.
OTP Validation API
Endpoint POST https://apiwa.nuverax.com/api/v1/otp/verify
Payload Request
| Property | Required | Description |
|---|---|---|
code | ✅ | Your OTP to validate. |
code_verifier | ❌ | PKCE Code verifier value. Required only if the initial request included code_challenge. |
Example Request
- cURL
- Js fetch
curl --location 'https://apiwa.nuverax.com/api/v1/otp/verify' \
--header 'Api-Key: [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{
"code": "[YOUR_OTP_CODE_TO_VALIDATE]"
}'
var myHeaders = new Headers();
myHeaders.append("Api-Key", "[YOUR_API_KEY]");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"code": "[YOUR_OTP_CODE_TO_VALIDATE]"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw
};
fetch("https://apiwa.nuverax.com/api/v1/otp/verify", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
info
You will need to get a valid Prod or Dev API Key to call the API. Read the next documentation to see how.
Payload Response
| Property | Description |
|---|---|
successful | True if the OTP validation was successful. |
id_token | Token Id on JWT format, includes useful information on the payload. |
Id Token Payload
| Property | Description |
|---|---|
exp | Expiration time of the JWT (24 hours by default). |
iat | Creatiion time of the JWT. |
sub | User account Id. |
env | Environment of the JWT (It could be production or development). |
aud | Programmable OTP application id. |
iss | The issuer of the JWT (https://wa.nuverax.com by default). |
nonce | Nonce value previously generated by the client application. |
is_custom | True if the JWT was created by a Programmable OTP application. |
p_hash | Phone number hash (SHA-256 of the registered phone number including country code). For example country_code=52 and phone_number=5512345678 the final phone number is 525512345678 so the SHA-256 is 8f9d0944329b5338c6fb86f293ceb39385b596254748dd3628ec62f55c334811 |