This version is deprecated and will be removed in the future, please use v2 instead.

Authentication

Authentication related to basic endpoints

Some endpoints may require you to be authenticated. This is done by sending an Authorization header with your access token along with your request.


Login

POST/auth/login

In order to receive an access token you will need to login. You do not need to register an account, you can simply login with any username.

You can login by sending a POST request to the /auth/login endpoint with your username in the request body.

Request
{
  "username": "my_username"
}

In return you will receive a response with the following body:

Response
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
}

You can now use this access token as the Bearer token in the Authorization header for all endpoints that require authentication.


Example of sending Authorization header.

The following example shows how to send an Authorization header with your request.

Example
const options = {
  headers: {
    Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
  }
}

const response = await fetch(`${API_BASE_URL}/quotes`, options)
const data = await response.json()