Login
POST/auth
The Login request allows users to authenticate themselves with ANSCER ANYA by providing their email address and password. This request does not require any additional parameters and can be accessed by any unauthenticated user.
To use this request, you need to provide your email address and password to ANSCER ANYA and send the request to the API endpoint. Once the request is sent, ANSCER ANYA will verify your credentials and return a JSON Web Token (JWT) that can be used to authenticate subsequent requests.
Request
- application/json
Body
required
Possible values: >= 5 characters and <= 255 characters
Possible values: >= 6 characters and <= 255 characters
Responses
- 200
- 400
- 403
- 500
User logged in
Response Headers
x-auth-token string
JWT token
- application/json
- Schema
- Example (from schema)
Schema
Possible values: >= 3 characters and <= 50 characters
Possible values: >= 5 characters and <= 255 characters
Possible values: [developer, admin, user]
JWT token
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"email": "user@example.com",
"role": "developer",
"token": "string"
}
Bad Request due to validation errors in the request body
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Validation failed.",
"errors": [
{
"field": "email",
"message": "Email must be a valid email address."
},
{
"field": "password",
"message": "Password must be 6 characters or longer."
}
]
}
{
"message": "Validation failed.",
"errors": [
{
"field": "email",
"message": "Email must be a valid email address."
},
{
"field": "password",
"message": "Password must be 6 characters or longer."
}
]
}
Forbidden.
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Access to this resource is forbidden."
}
{
"message": "Access to this resource is forbidden."
}
Internal Server Error
- application/json
- Schema
- Example (from schema)
- Example
Schema
- any
{
"message": "Internal Server Error. Please try again later."
}
{
"message": "Internal Server Error. Please try again later."
}