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:

ParameterTypeRequiredDescription
emailstringUser email
passwordstringUser password

Example

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,
"email": "[email protected]",
"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.

curl \
-H "authorization: Token <authToken>" \
-X POST \
https://analogue.com/api/<some_authed_endpoint>