For Authlete 2.x documentation, see 2.x version.
Overview
In Authlete 3.0, token durations can be configured at the Service level, Client level, and Scope level. Configuring token durations per scope provides fine-grained control, such as issuing shorter-lived tokens for higher-privilege scopes likewrite while allowing longer durations for lower-privilege scopes like read.
For more details on configuring token durations statically at the client level, refer to the Token Duration Per Client documentation.
This short article explains how to set token durations for access tokens at the scope level.
Configuring Token Duration Per Scope
To configure token durations for specific scopes in Authlete 3.0, follow these steps:- Log in to the Authlete Management Console.
- Navigate to Service Settings > Tokens and Claims > Advanced.
- Under the Supported Scopes section, click the Add button.
- In the Add/Edit Supported Scope dialog:
- Enter the Scope Name (e.g.,
readorwrite). - Provide a description for the scope.
- Enter the Scope Name (e.g.,
- Scroll to the Scope Attributes section.
- Click Add to add a new attribute:
- Set the Key to
access_token.duration,refresh_token.durationorid_token.durationdepending on the type of token you want to change the duration for. - Set the Value to the desired token duration in seconds (e.g.,
3600for 1 hour).
- Set the Key to
- Click Add again at the bottom of the dialog to save the scope attribute.
Example
Assume there is a service and two scopes configured within it. The access token durations are set as follows:| Entity | Access Token Duration (seconds) |
|---|---|
| Service | 86,400 |
read scope | 3,600 |
write scope | 600 |
1. Response to an authorization request with no scopes
2. Response to an authorization request with read scope
read scope is used.
3. Response to an authorization request with write scope
write scope is used.