> ## Documentation Index
> Fetch the complete documentation index at: https://developers.authlete.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How Authlete determines token duration

> Technical information on how Authlete determines token duration based on different versions like Authlete 1.x and Authlete 2.0.

<Note>
  This page is for **Authlete 2.x**. For current (3.0) documentation, see [this page](/configuration-reference/tokens-and-claims/how-authlete-determines-token-duration).
</Note>

## Preface

Authlete determines duration of effective time of tokens (access tokens and refresh tokens) when issuing them. This article describes how Authlete versions calculate token duration (hereinafter *duration*). 

## Authlete 1.x

Authlete uses a value of **token duration configured for a service**. The value is set as an initial value of *duration*.<img src="https://mintcdn.com/authlete/KNbgpS77nJg5j2Vw/img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_1.png?fit=max&auto=format&n=KNbgpS77nJg5j2Vw&q=85&s=566355e3f543f044440316bdf7a67f7d" alt="how-to-calculate-token-duration_1" width="541" height="610" data-path="img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_1.png" />

## Authlete 2.0

Authlete 2.0 supports **token duration per scope**. In addition to the calculation process in Authlete 1.x, Authlete performs the following calculation steps. 

* Check which scopes are requested by clients
* If token duration is set for any of the requested scopes (see [Token duration per scope](/configuration-reference/tokens-and-claims/token-duration-per-scope) for more details), perform the following steps.

  * Get the minimum value out of all the token duration that are set for those scopes.
  * If the value obtained above is smaller than the current *duration*, Authlete sets the smaller value for the new *duration*.

<img src="https://mintcdn.com/authlete/KNbgpS77nJg5j2Vw/img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_2.png?fit=max&auto=format&n=KNbgpS77nJg5j2Vw&q=85&s=23111441a89e6e7d82f98d563ab48751" alt="how-to-calculate-token-duration_2" width="962" height="548" data-path="img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_2.png" />

## Authlete 2.1 and later

Authlete 2.1 and later supports **token duration per client**. In addition to the calculation processes in Authlete 1.x and 2.0 above, Authlete performs another calculation step. 

* Check which client is the requestor
* If token duration is set for the requesting client (see [Token duration per client](/configuration-reference/tokens-and-claims/token-duration-per-client) for more details), Authlete compares the value with the current *duration* and sets the smaller one for the new *duration*.

<img src="https://mintcdn.com/authlete/KNbgpS77nJg5j2Vw/img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_3.png?fit=max&auto=format&n=KNbgpS77nJg5j2Vw&q=85&s=aa9107bdefa453bdbd782b4560d8bd59" alt="how-to-calculate-token-duration_3" width="481" height="266" data-path="img/kb/en/oauth-and-openid-connect/tokens/how-to-calculate-token-duration_3.png" />

## See also

* [Token duration per scope](/configuration-reference/tokens-and-claims/token-duration-per-scope)
* [Token duration per client](/configuration-reference/tokens-and-claims/token-duration-per-client)
