Files
bookhoard/bruno/user/Login User.bru
T

60 lines
1.0 KiB
Plaintext

meta {
name: Login User
type: http
seq: 2
}
post {
url: {{base_url}}/api/auth/login
body: json
auth: inherit
}
body:json {
{
"login": "test@example.com",
"password": "password123"
}
}
script:post-response {
function onResponse(res) {
let data = res.getBody();
return bru.setEnvVar("token", data.token, { persist: true });
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Login User
Authenticates a user with email/username and password.
**Method:** POST
**Endpoint:** /api/auth/login
**Request Body:**
- `login` (string): Email or username
- `password` (string): Password
**Response:**
- `token` (string): JWT token
- `user` (object): User details
- `id` (string): User ID
- `email` (string): Email
- `username` (string): Username
- `theme` (string): User theme preference
- `first_name` (string): First name
- `last_name` (string): Last name
**Status Codes:**
- 200: Success
- 401: Invalid credentials
}