The login endpoint validates a user’s credentials and issues a Laravel Sanctum personal access token. Smart Enviro Backend enforces a single active session per user — if the account already has an active token stored inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt
Use this file to discover all available pages before exploring further.
users.current_token, the request returns 409 Conflict without revoking the existing session.
Endpoint
| Field | Value |
|---|---|
| Method | POST |
| Path | /api/login |
| Auth required | No |
Request Body
Valid email address of the registered user.
Account password.
Request Example
Responses
200 OK — Login successful
Credentials matched and no active session existed. Returns the authenticated user object and a plain-text Sanctum bearer token.Always
"success" on a 200 response.Human-readable confirmation message (
"Inicio de sesión exitoso").Wrapper object containing the authenticated user and the issued token.
401 Unauthorized — Wrong credentials
The email does not exist or the password does not match the stored hash.409 Conflict — Account already has an active session
The user record has a non-nullcurrent_token, meaning the account is already logged in on another device.
422 Unprocessable Entity — Validation failed
The request body is missing a required field or theemail value is not a valid email address. Laravel returns a standard validation error response body with a errors object keyed by field name.
Using the Token
Include the token returned in thedata.token field as a Bearer token in the Authorization header for all authenticated endpoints:
The returned
token is a plain-text Sanctum token. Store it securely (e.g. in secure storage on mobile) and never expose it in URLs or logs.