> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/technical-guide/getting-started-guide/authentication.md).

# Authentication

The initial step that needs to be configured is the authentication flow. See the sample example how this can be configured. Links to more detailed instructions can be found at the end of the article.

## How this example works

OpenLoyalty uses JWT Tokens to authenticate all API calls.

Properly setting up authentication is crucial for maintaining application security and ensuring uninterrupted service. This helps avoid issues such as excessive request rates or the use of invalid or expired tokens.

***

## Try yourself <a href="#to-try-it-yourself" id="to-try-it-yourself"></a>

* Login with the admin username and password\
  Endpoint: `POST /api/admin/login_check`
* Save `token` and `refresh_token` from the responses
* Refresh your previously saved token\
  Endpoint: `POST /api/token/refresh`
* Input the token in the header for all the subsequent requests

***

## Endpoints used

{% openapi src="/files/jvocRY6tlAWocBwKFsNL" path="/api/admin/login\_check" method="post" %}
[openapi-5.61.0 (1).json](https://123136216-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIv2CyIIYf7vRfuhMKQ6%2Fuploads%2Fgit-blob-c6d6d1ae03b533a9dcf7bf7e18c3fbc4e23b0e6b%2Fopenapi-5.61.0%20\(1\).json?alt=media)
{% endopenapi %}

{% openapi src="/files/jvocRY6tlAWocBwKFsNL" path="/api/token/refresh" method="post" %}
[openapi-5.61.0 (1).json](https://123136216-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIv2CyIIYf7vRfuhMKQ6%2Fuploads%2Fgit-blob-c6d6d1ae03b533a9dcf7bf7e18c3fbc4e23b0e6b%2Fopenapi-5.61.0%20\(1\).json?alt=media)
{% endopenapi %}

***

## More resources

For a detailed overview and description of the authentication flow, please refer to these articles:

{% content-ref url="/pages/wWSTbQ7u6To0KYJC4ULL" %}
[Broken mention](broken://pages/wWSTbQ7u6To0KYJC4ULL)
{% endcontent-ref %}

{% content-ref url="/spaces/cNVX03KZzmrGwJihLiEx/pages/CorKO59lYm6ixrZAApCn" %}
[Admins](/administration/settings/admins.md)
{% endcontent-ref %}

{% content-ref url="/pages/d8TNVA1byARcglBE8Ovo" %}
[Broken mention](broken://pages/d8TNVA1byARcglBE8Ovo)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.openloyalty.io/technical-guide/getting-started-guide/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
