With auth enabled, you have to retrieve a JWT token before you can access the API calls.
Username/password login
Send the username and password, as defined in api.auth.username and api.auth.password, in the body of the request to the /api/login endpoint in order to obtain valid access and refresh JWT.
By creating a new core client, the login automatically happens. If the login fails, coreclient.New() will return an error.
Description:
Auth0 login
Send a valid Auth0 access JWT in the Authorization header to the /api/login endpoint in order to obtain an access and refresh JWT. The Auth0 tenant and the allowed users must be defined in the configuration.
The client handles the refresh of the tokens automatically. However, the access_token can also be updated manually:
from core_client import Clientclient =Client( base_url="http://127.0.0.1:8080", refresh_token="eyJz93a...k4laUWw",)client.token_refresh()
The client handles the refresh of the tokens automatically. However, you can extract the currently used tokens from the client:
accessToken, refreshToken := client.Tokens()
You can use these tokens to continue this session later on, given that at least the refresh token didn't expire yet. This saves the client a login round-trip: