Aller au contenu
Accueil » API SMS Octopush » OTP – MFA – Double Authentification » OTP / MFA – Validation de code

OTP / MFA – Validation de code

PUT
https://api.octopush.com/v1/public/service/otp/validate

Encodage : UTF-8

Authentification

La api-key et le api-login doivent être ajoutés dans un header.

Définition

Permet de valider un code OTP généré sur Octopush.

Paramètres

NomTypeDescription
phone_numberstring(optionel, obligatoire si otp_request_token est absent) Numéro de téléphone au format international +XXZZZZZ : « +33611223344 »
codestringCode OTP tapé par votre visiteur / utilisateur.
otp_request_tokenstring(optionnel, obligatoire si phone_number est absent) Token de l’OTP que vous essayez de valider. Si cette valeur est absente, Octopush essaiera de valider le dernier code envoyé à ce destinataire

Exemples Curl

curl -X PUT \ 
'https://api.octopush.com/v1/public/service/otp/validate' \ 
-H 'Content-Type: application/json' \ 
-H 'api-login: ******@email.org' \ 
-H 'api-key: ************' \ 
-H 'cache-control: no-cache' \ 
-d '
{
  "code": "TRQXSDYNJY",
  "otp_request_token": "otp_111111dab2222222aaa33333"
}'

Code à copier-coller

curl -X PUT 'https://api.octopush.com/v1/public/service/otp/validate' -H 'Content-Type: application/json' -H 'api-login: ******@email.org' -H 'api-key: ************' -H 'cache-control: no-cache' -d '{"code": "TRQXSDYNJY", "otp_request_token": "otp_111111dab2222222aaa33333"}'

Retour Server en json

Success : 200 Created

{
  "code": 0,
  "message": "success"
}

Error : 400 BAD REQUEST

{
  "code": 199,
  "message": "Wrong OTP code.",
  "remaining_number_of_attempts": 3
}

Failure : 400 BAD REQUEST

{
  "code": 194,
  "message": "At least phone number or request token is mandatory."
}

Exemples de code retours

CodeDescription
194At least phone number or request token is mandatory.
195The code field is mandatory.
196Maximum amount of wrong attempts has been reached.
197OTP Request expired.
198OTP Request not found.
199Wrong otp code.