Skip to content

Commit e7a0dbd

Browse files
authored
feat: add max_age param for auth0 (#26)
Forces reauthentication whenever user logs out, and shows Auth0 Universal Login Can be set when defining auth0EventHandler, same as `emailRequired`
1 parent 79f7ce7 commit e7a0dbd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/runtime/server/lib/oauth/auth0.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export interface OAuthAuth0Config {
3939
* @default false
4040
*/
4141
emailRequired?: boolean
42+
/**
43+
* Maximum Authentication Age. If the elapsed time is greater than this value, the OP must attempt to actively re-authenticate the end-user.
44+
* @default 0
45+
* @see https://auth0.com/docs/authenticate/login/max-age-reauthentication
46+
*/
47+
maxAge?: number
4248
}
4349

4450
export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>) {
@@ -73,6 +79,7 @@ export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OA
7379
redirect_uri: redirectUrl,
7480
scope: config.scope.join(' '),
7581
audience: config.audience || '',
82+
max_age: config.maxAge || 0,
7683
})
7784
)
7885
}

0 commit comments

Comments
 (0)