Auth
LIVETest frontend login flows. Any seeded username + password password succeeds; anything else returns 401.
Endpoints
- POSTLogin — password is always password
- GETCurrent user via Bearer token
Query params
| Param | Description | Example |
|---|---|---|
| lang | Pass fa for Persian text · omit for English (default) | lang=fa |
| delay | Artificial wait in ms · max 5000 | delay=800 |
| status | Force error HTTP status · 400–599 | status=500 |
Persian user fields in the response: add lang=fa. See Docs · Language.
Demo credentials
Use any username from /api/users. Password is always password.
Request
1import axios from 'axios';2 3const { data } = await axios.post('/api/auth/login', {4 username: 'avachen',5 password: 'password',6});7 8localStorage.setItem('token', data.data.token);9// Wrong password → axios throws, status 401Response
1{2 "data": {3 "token": "mock.7c9e6679-7425-40de-944b-e07fc1f90ae7",4 "tokenType": "Bearer",5 "expiresIn": 3600,6 "user": {7 "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",8 "name": "Ava Chen",9 "username": "avachen",10 "email": "ava.chen@example.com",11 "role": "admin"12 }13 }14}Response
1{2 "error": {3 "code": "UNAUTHORIZED",4 "message": "Invalid username or password"5 }6}