resetOutTokenApi - n1lby73/industrial-IOT GitHub Wiki

Overview

The resetOutTokenApi endpoint is utilized for resetting a user's password using a token. This endpoint is specifically designed for scenarios where users are logged out or do not have an active session. It allows users to update their password by providing a token sent to their email during a password reset request.

Endpoint URL

  • URL: https://industrialiot.onrender.com/api/resetouttoken
  • Method: PUT

Request Parameters

  • Headers:

    • Content-Type: application/json
  • Body Parameters:

    Parameter Type Description
    token String Token received via email (required)
    new String New password (required)

    Note: Do not forget to do a client side verification for newpass to confirm that user is aware of characters of his password.

Responses

  • Success Response:

    • Status Code: 200 OK

    • Response Body:

      {
        "succcess": "password updated successfully"
      }
      
      • Description: Indicates a successful password update.
  • Error Responses:

    • Status Code: 400 Bad Request

      • Response Body:
      {
       "error": "invalid token"
      }
      
      • Description: Indicates an invalid or unrecognized token provided.
    • Status Code: 400 Bad Request

      • Response Body:
      {
        "error": "expired token"
      }
      
      • Description: Indicates that the token has expired.
    • Status Code: 401 unauthorized

      • Response Body:
      {
       "error": "user is logged in"
      }
      
      • Description: Indicates that the user is logged in.
    • Status Code: 500 Internal server error

      • Response Body:
      {
       "error": "failed to trash expired token"
       "details": "<ERROR_DETAILS>"
      }
      
      • Description: Indicates inability to trash the old token.
    • Status Code: 500 Internal server error

    • Response Body:

    {
     "error": "password update unsuccessfull"
      "details": "<ERROR_DETAILS>"
    }
    
    • Description: Indicates inability to update the password.

Usage

  1. Request Method: PUT

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

  3. Header:

     Content-Type: application/json
    
  4. Request Body:

    {
      "token": "<RESET_TOKEN>",
      "new": "<NEW_PASSWORD>"
    }
    

Additional Information

This endpoint is affected by before request endpoints for user authentication and verification before processing the password reset operation.