genOtpApi - n1lby73/industrial-IOT GitHub Wiki

Overview

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.

Endpoint URL

  • URL: https://industrialiot.onrender.com/api/genotp
  • Method:GET

Request Parameters

  • Headers:

    • Authorization: Bearer <JWT>
  • Body Parameters: None

Responses

  • 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.
    • Status Code: 400 Bad Request

      • Response Body:
        {
            "Msg": "email verification already completed"
        }
      • Description: Indicates that the email verification has already been completed.
    • 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.
    • 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.

Usage

  1. Request Method: GET

  2. Endpoint URL: https://industrialiot.onrender.com/api/genotp

  3. Header:

    Authorization: Bearer <JWT>

Functionality Details

The genOtpApi endpoint generates and sends an OTP to the user's email for verification. It ensures that email verification occurs before certain operations.

⚠️ **GitHub.com Fallback** ⚠️