Authentication¶
The RECreation API uses Keycloak for authentication via OAuth 2.0 / OpenID Connect.
All requests must include a Bearer JWT token in the Authorization header.
Obtaining a Token¶
The response includes:
{
"access_token": "eyJhbGci...",
"expires_in": 300,
"refresh_token": "eyJhbGci...",
"token_type": "Bearer"
}
Using the Token¶
Include the token in every request:
Token Refresh¶
Access tokens expire after 5 minutes. Use the refresh token to obtain a new one:
curl -X POST \
"https://<keycloak-host>/realms/<your-realm>/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "client_id=recreation" \
-d "refresh_token=<refresh_token>"
Token Expiry
Refresh tokens also expire (typically 30 minutes). If both tokens expire, the user must re-authenticate with credentials.