The login endpoint is powered byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/viet2811/uk-travel-recommendation/llms.txt
Use this file to discover all available pages before exploring further.
djangorestframework-simplejwt’s built-in TokenObtainPairView. Providing a valid username and password returns two signed JSON Web Tokens: a short-lived access token that authorises individual API requests, and a long-lived refresh token that lets the client silently obtain new access tokens without asking the user to re-enter their credentials. The access token expires after 15 minutes and the refresh token after 30 days. All protected endpoints in this API expect the access token to be passed in the Authorization header as a Bearer token. No prior authentication is needed to call this endpoint itself.
Endpoint
| Method | POST |
| Path | /api/user/token/ |
| Auth required | No |
| Content-Type | application/json |
Token lifetimes
| Token | Lifetime | Purpose |
|---|---|---|
access | 15 minutes | Authorise individual API requests via Authorization: Bearer <token> |
refresh | 30 days | Obtain a new access token via Refresh Token without re-login |
Request Body
The username supplied during registration.
The account password. The value is compared against the stored hash — it is never echoed back in any response.
Responses
200 OK
Returned when credentials are valid. The response contains both tokens.A signed JWT access token. Valid for 15 minutes from the time of issue. Include this value in the
Authorization: Bearer <access> header on every protected request.A signed JWT refresh token. Valid for 30 days from the time of issue. Store this securely and use it to obtain a new access token when the current one expires — see Refresh Token.
200 OK
401 Unauthorized
Returned when the username does not exist or the password is incorrect.simplejwt does not distinguish between the two cases to prevent username enumeration.
401 Unauthorized
Storing tokens securely in React Native — never persist JWTs in
AsyncStorage (plain-text). Use expo-secure-store (SecureStore.setItemAsync) to store both the access token and the refresh token in the device’s encrypted keychain. Retrieve them with SecureStore.getItemAsync before making API calls.Examples
Using the access token
Once you have the access token, attach it to every subsequent protected request in theAuthorization header: