Authorization Token
The API uses JWT for authentication.
First, authorize using this endpoint to get an authorization token, which you can then pass through as an Authorization header for authenticated endpoints.
Token Expiration
Authorization tokens automatically expire in 60 days.
POST /user/login
Obtain an authorization token.
Params
Pass in a user
param with the following key value pairs:
Parameter | Type | Required | Description |
---|---|---|---|
email | string | ✓ | User email |
password | string | ✓ | User password |
Example
- Shell
- JavaScript
curl \
-H 'Content-Type: application/json' \
-X POST \
-d '{"user": { "email" "<your_email>", "password": "<your_password>" }}' \
https://analogue.com/api/users/login
Response
{
"user": {
"id": 1,
"username": "analogue",
"name": "Analogue App",
"bio": "Share what inspires you.",
"topics": [],
"image": "direct_url_to_image",
"token": "eyjhafdsf****", // AUTHORIZATION TOKEN
}
}
Authorized Endpoints
For authorized endpoints, Analogue expects for the JWT token
received from Login
to be included in the header of the request.
- Shell
- JavaScript
curl \
-H "authorization: Token <authToken>" \
-X POST \
https://analogue.com/api/<some_authed_endpoint>