Skip to content

Commit

Permalink
feat: add max_age param for auth0 (#26)
Browse files Browse the repository at this point in the history
Forces reauthentication whenever user logs out, and shows Auth0 Universal Login
Can be set when defining auth0EventHandler, same as `emailRequired`
  • Loading branch information
BerzinsU authored Nov 29, 2023
1 parent 79f7ce7 commit e7a0dbd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/server/lib/oauth/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export interface OAuthAuth0Config {
* @default false
*/
emailRequired?: boolean
/**
* Maximum Authentication Age. If the elapsed time is greater than this value, the OP must attempt to actively re-authenticate the end-user.
* @default 0
* @see https://auth0.com/docs/authenticate/login/max-age-reauthentication
*/
maxAge?: number
}

export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>) {
Expand Down Expand Up @@ -73,6 +79,7 @@ export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OA
redirect_uri: redirectUrl,
scope: config.scope.join(' '),
audience: config.audience || '',
max_age: config.maxAge || 0,
})
)
}
Expand Down

0 comments on commit e7a0dbd

Please sign in to comment.