Verify OTP code that sent to user's email or phone number.
POST /otp/verification
POST
/otp/verification
After verifying OTP code, user will get request_id that is required to do some activities like: reset password, change phone, etc.
Flow:
- Validate request.
- otpType, otpCode and identifier are required.
- otpType should be a valid one(change_phone/reset_password).
- identifier should be a valid email or phone number. - Validate based on otpType
- reset_password: query user by identifier, user should exists and have valid user status(not blocked/paused).
- change_phone: query user by identifier, user should not exists. if exist error phone already registered. - Get OTP code from cache. (cache set in POST /otp)
- Validate OTP code from request should be the same as the one in cache.
- Generate requestToken(jwt) and return to user.
- Delete OTP code from cache.
- requestToken will be used on other APIs:
- PATCH /users/password
- PATCH /users/phone
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”VerifyOTPRequest
object
identifier
Email or phone number
string
+6282243350992 otpCode
OTP Code
string
22222 otpType
Reset_password | change_phone
string
reset_passwordResponses
Section titled “ Responses ”OK
object
data
object
requestToken
Request token
string
Bad request
object
error
string
some meaningful error messageInternal server error
object
error
string
some meaningful error message