Skip to main content
Authenticate a user and obtain an access token.
This endpoint verifies the user’s email and password, checks the user role (user), and returns a JWT token upon successful authentication.

Request Body

email
string
required
The user’s email address
password
string
required
The user’s password

Example Request

curl -X POST "https://api.scorton.tech/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "StrongPassword123!"
  }'

Example Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "TokenType"
}

Success Response

StatusDescription
200 OKUser authenticated successfully; returns access_token, role, and user_id

Error Responses

StatusDescriptionExample
401 UnauthorizedInvalid credentials or role mismatchjson { "detail": "Unauthorized: Invalid credentials." }
404 Not FoundUser email not foundjson { "detail": "Not Found: User not found." }
500 Internal Server ErrorUnexpected server errorjson { "detail": "An unexpected error occurred" }