loginApi - n1lby73/industrial-IOT GitHub Wiki
Overview
The Login API endpoint enables user authentication by validating provided email and password credentials. Upon successful authentication, the API generates access and refresh tokens, granting access to protected resources.
Endpoint URL
- URL:
https://industrialiot.onrender.com/api/login
- Method:
POST
Request Parameters
- Headers:
- Content-Type: application/json
- Body Parameters:
Parameter | Type | Description |
---|---|---|
email |
String | User's email (required). |
password |
String | User's password (required). |
Responses
-
Success Response:
- Status Code: 200 OK
- Response Body:
{ "success": "login successful", "token": { "access_token": "<ACCESS_TOKEN>", "refresh_token": "<REFRESH_TOKEN>" } }
- Description: Indicates successful login.
-
Error Responses:
-
Status Code: 400 Bad Request
- Response Body:
{ "error": "incorrect credentials" }
- Description: Indicates incorrect credentials provided.
- Response Body:
-
Status Code: 403 Forbidden
- Response Body:
{ "error": "email verification not complete" }
- Description: Indicates uncompleted email verification.
- Response Body:
-
Status Code: 500 Internal Server Error
- Response Body:
{ "error": "could not login", "details": "<ERROR_DETAILS>" }
- Description: Indicates a server error during login.
- Response Body:
-
Usage
- Request Method:
POST
- Endpoint URL:
https://industrialiot.onrender.com/api/login
- Header:
Content-Type: application/json
- Request Body: Users login credentials.
{ "email": "[email protected]", "password": "user_password" }