Skip to content

Commit 900201a

Browse files
authored
fix(core,schemas): align refresh token grant lifetime (#7924)
fixed #7840
1 parent c602b9e commit 900201a

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@logto/schemas': patch
3+
'@logto/core': patch
4+
---
5+
6+
align refresh token grant lifetime with 180-day TTL
7+
8+
Refresh tokens were expiring after 14 days because the provider grant TTL was still capped at the default two weeks, regardless of the configured refresh token TTL.
9+
10+
Now set the OIDC grant TTL to 180 days so refresh tokens can live for their configured duration, also expand the refresh token TTL up to 180 days.

packages/core/src/oidc/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ export default function initOidc(
362362
},
363363
Interaction: 3600 /* 1 hour in seconds */,
364364
Session: 1_209_600 /* 14 days in seconds */,
365-
Grant: 1_209_600 /* 14 days in seconds */,
365+
// Set this to the longest allowed duration of the refresh token
366+
Grant: 180 * 3600 * 24 /* 180 days in seconds */,
366367
},
367368
rotateRefreshToken: (ctx) => {
368369
const { Client: client } = ctx.oidc.entities;

packages/schemas/src/foundations/jsonb-types/oidc-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const customClientMetadataGuard = z.object({
8484
[CustomClientMetadataKey.CorsAllowedOrigins]: z.string().min(1).array().optional(),
8585
[CustomClientMetadataKey.IdTokenTtl]: z.number().optional(),
8686
[CustomClientMetadataKey.RefreshTokenTtl]: z.number().optional(),
87-
[CustomClientMetadataKey.RefreshTokenTtlInDays]: z.number().int().min(1).max(90).optional(),
87+
[CustomClientMetadataKey.RefreshTokenTtlInDays]: z.number().int().min(1).max(180).optional(),
8888
[CustomClientMetadataKey.TenantId]: z.string().optional(),
8989
[CustomClientMetadataKey.AlwaysIssueRefreshToken]: z.boolean().optional(),
9090
[CustomClientMetadataKey.RotateRefreshToken]: z.boolean().optional(),

0 commit comments

Comments
 (0)