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
Login with the admin username and password Endpoint:
POST /api/admin/login_checkSave
tokenandrefresh_tokenfrom the responsesRefresh your previously saved token Endpoint:
POST /api/token/refreshInput the token in the header for all the subsequent requests
Endpoints used
This method allows to login and get a JWT token for the admin
adminpasswordeyJhbGciOiJSUzI1NiIsInR5cCI6...0558f8bb29948c4e54c443f...Bad credentials.
POST /api/admin/login_check HTTP/1.1
Host: openloyalty.localhost
Content-Type: application/json
Accept: */*
Content-Length: 42
{
"username": "admin",
"password": "password"
}{
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6...",
"refresh_token": "0558f8bb29948c4e54c443f..."
}0558f8bb29948c4e54c443f...eyJhbGciOiJSUzI1NiIsInR5cCI6...0558f8bb29948c4e54c443f...Bad credentials.
POST /api/token/refresh HTTP/1.1
Host: openloyalty.localhost
Content-Type: application/json
Accept: */*
Content-Length: 46
{
"refresh_token": "0558f8bb29948c4e54c443f..."
}{
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6...",
"refresh_token": "0558f8bb29948c4e54c443f..."
}More resources
For a detailed overview and description of the authentication flow, please refer to these articles:
AdminsLast updated
Was this helpful?

