You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default `rotateRefreshToken` value puts forth a sensible refresh
token rotation policy
- only allows refresh tokens to be rotated (have their TTL prolonged by
issuing a new one) for one year.
- otherwise always rotate public client tokens
- otherwise only rotate tokens if they're being used close to their
expiration (>= 70% TTL passed)
This remains to be just a default that you can modify or return to its
original `true` value.
BREAKING CHANGE: default `rotateRefreshToken` configuration value
is now a function with a described policy that follows
[OAuth 2.0 Security Best Current Practice](https://tools.ietf.org/html/draft-ietf-oauth-security-topics-12)
...if a client has the grant whitelisted and scope includes offline_access or the client is a public web client doing code flow. Configure `issueRefreshToken` like so
2327
+
... If a client has the grant whitelisted and scope includes offline_access or the client is a public web client doing code flow. Configure `issueRefreshToken` like so
2328
2328
2329
2329
2330
2330
```js
@@ -2505,29 +2505,30 @@ _**default value**_:
2505
2505
Configures if and how the OP rotates refresh tokens after they are used. Supported values are
2506
2506
-`false` refresh tokens are not rotated and their initial expiration date is final
2507
2507
-`true` refresh tokens are rotated when used, current token is marked as consumed and new one is issued with new TTL, when a consumed refresh token is encountered an error is returned instead and the whole token chain (grant) is revoked
2508
-
- function returning true/false, true when rotation should occur, false when it shouldn't
2508
+
-`function` returning true/false, true when rotation should occur, false when it shouldn't
2509
+
The default configuration value puts forth a sensible refresh token rotation policy
2510
+
- only allows refresh tokens to be rotated (have their TTL prolonged by issuing a new one) for one year
2511
+
- otherwise always rotate public client tokens
2512
+
- otherwise only rotate tokens if they're being used close to their expiration (>= 70% TTL passed)
// cap the maximum amount of time a refresh token can be
2520
+
// rotated for up to 1 year, afterwards its TTL is final
2521
+
if (refreshToken.totalLifetime() >=365.25*24*60*60) {
2522
+
returnfalse;
2523
+
}
2524
+
// rotate public client refresh tokens
2525
+
if (client.tokenEndpointAuthMethod==='none') {
2526
+
returntrue;
2527
+
}
2528
+
// rotate if the token is nearing expiration (it's beyond 70% of its lifetime)
2529
+
returnrefreshToken.ttlPercentagePassed() >=70;
2528
2530
}
2529
2531
```
2530
-
</details>
2531
2532
2532
2533
### routes
2533
2534
@@ -2677,6 +2678,7 @@ When doing that be sure to remove the client provided headers of the same name o
2677
2678
Expirations (in seconds, or dynamically returned value) for all token types
2678
2679
2679
2680
2681
+
_**recommendation**_: Do not set token TTLs longer then they absolutely have to be, the shorter the TTL, the better. Rather than setting crazy high Refresh Token TTL look into `rotateRefreshToken` configuration option which is set up in way that when refresh tokens are regularly used they will have their TTL refreshed (via rotation). This is inline with the [OAuth 2.0 Security Best Current Practice](https://tools.ietf.org/html/draft-ietf-oauth-security-topics-12)
0 commit comments