genOtpApi - n1lby73/industrial-IOT GitHub Wiki
The GenOTP API endpoint triggers the generation and sending of a one-time password (OTP) to a user's registered email address for email verification.
-
URL:
https://industrialiot.onrender.com/api/genotp
-
Method:
GET
-
Headers:
-
Authorization:
Bearer <JWT>
-
Authorization:
- Body Parameters: None
-
Success Response:
- Status Code: 200 OK
-
Response Body:
{ "status": "otp sent to mail" }
- Description: Indicates successful generation and sending of the OTP to the user's email.
-
Error Responses:
-
Status Code: 400 Bad Request
-
Response Body:
{ "error": "Invalid email format" }
- Description: Indicates an issue with the email format.
-
Response Body:
-
Status Code: 400 Bad Request
-
Response Body:
{ "Msg": "email verification already completed" }
- Description: Indicates that the email verification has already been completed.
-
Response Body:
-
Status Code: 400 Bad Request
-
Response Body:
{ "error": "login before requesting otp" }
- Description: Indicates that the user needs to log in before requesting an OTP.
-
Response Body:
-
Status Code: 500 Internal Server Error
-
Response Body:
{ "Error": "could not send to mail", "Details": "<ERROR_DETAILS>" }
- Description: Indicates a server error occurred during OTP generation or sending.
-
Response Body:
-
-
Request Method:
GET
-
Endpoint URL:
https://industrialiot.onrender.com/api/genotp
-
Header:
Authorization: Bearer <JWT>
The genOtpApi endpoint generates and sends an OTP to the user's email for verification. It ensures that email verification occurs before certain operations.