Skip to main content

OTP Engine

Get Client Config

url:

GET /v1/oidc/config

Header:

Authorization: Basic <base64(client_id:client_secret)>

Response:

{
"otp_expiry": 180,  
"otp_max_invalid_attempts": 3,  
"otp_length": 5,  
"otp_request_interval": 60,  
"regenerate_otp": false,  
"timestamp": "2023-06-19T07:02:07Z",  
"access_token_lifespan": 7776000,  
"refresh_token_max_lifespan": 7862400,  
"refresh_token_max_reuse": 13
}

Configuration Field Descriptions

FieldTypeDescription
otp_expiryintOTP expiration. In seconds
otp_max_invalid_attemptsintThis is a numerical value that specifies the maximum number of incorrect OTP attempts a user is allowed before some security action is triggered. For example, if you set it to 3, a user can enter the OTP incorrectly three times before additional security measures,such as locking the user out, are applied. the user can do next request depens on otp_request_interval duration.
otp_lengthintThe OTP length determines how many digits or characters are included in the OTP
otp_request_intervalintSpecifies the time interval in seconds, during which a user can request or generate a new One-Time Password (OTP) after their previous OTP request or generation. This parameter helps control how frequently OTPs can be requested to enhance security and prevent abuse.
regenerate_otpboolTrue: When "regenerate_otp" is set to true, it means that each time it is requested, a new OTP will be generated. This is often used for security reasons to ensure that the OTP is only valid for a single use or for a short period of time. Once the OTP is generated and sent to the user, it cannot be used again. False: When "regenerate_otp" is set to false, it means that the same OTP value will be provided until it is used . In this case, the OTP remains valid for a longer duration or until the user successfully authenticates using it.
access_token_lifespanintMax time before an access token is expired. In seconds
refresh_token_max_lifespanintMax time before a refresh token is expired. In seconds
refresh_token_max_reuseintMaximum number of times a refresh token can be reused. Default Used is 0, so when its set to 0 the refresh token can be used for request new access token once and cannot be reused. If the value is 1, the refresh token can be used for request new access token once and Reuse it Once. So on and so forth.

Login

Goto Here If you want to integrate with our login

OTP with Basic Auth

To request and validate OTP using otp with basic auth flow, you need to send base64(client_id:client_secret) as basic auth token. Here's the Example Flow Use Case:

ExampleFlow

API Endpoints

Request OTP

URL:
POST /v1/passwordless/start
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/json
Request Body:
{
"username": "081200010002"
}
Success (200) Response Body:
{
"username": "081200010002",
"otp": "123456",
"timestamp": "2023-01-01T00:00:00Z"
}
Failed (400) Response Body:
{
"error": "invalid_body",
"error_description": "Invalid Request Body",
"timestamp": "2023-08-21T02:44:53Z"
}

List Of Possible Response

http status codeerror codemessage
500unexpected_errorSomething Went Wrong
400invalid_request_bodyInvalid Request, Please Check Your Request Body
400invalid_request_bodyPlease Enter a valid username
401invalid_client_credentialInvalid Client Credentials
401identifier_has_active_verificationUser has Active OTP

Validate OTP

URL:
POST /v1/passwordless/validate

Header:
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/json
Request Body:
{
"username": "081200010002",
"otp": "123456"
}
Success (200) Response Body:
{
"message": "OTP Validated Successfully",
"timestamp": "2023-01-01T00:00:00Z"
}
Failed (400) Response Body:
{
"error": "invalid_otp",
"error_description": "OTP is Invalid",
"timestamp": "2023-01-01T00:00:00Z",
"metadata": {
"invalid_attempt": 2,
"max_invalid_attempt": 3
}
}

List Of Possible Response

http status codeerror codemessage
500unexpected_errorSomething Went Wrong
400invalid_request_bodyInvalid Request, Please Check Your Request Body
400invalid_request_bodyPlease Enter a valid username
400verification_not_foundVerification Not Found
400wrong_otp_request_limitWrong OTP Limit Request Exceeded
400invalid_otpOTP is Invalid
400verification_is_expiredVerification Expired
400used_otpOTP is Already Used
400invalid_otp_config_changedOTP is Invalid, Please Request New OTP
401invalid_client_credentialInvalid Client Credentials
401identifier_has_active_verificationUser has Active OTP