feat(auth): add oidc-client-ts UserManager with sessionStorage store
This commit is contained in:
19
auth/oidc.ts
Normal file
19
auth/oidc.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { UserManager, WebStorageStateStore, Log, type UserManagerSettings } from 'oidc-client-ts'
|
||||||
|
|
||||||
|
|
||||||
|
const settings: UserManagerSettings = {
|
||||||
|
authority: import.meta.env.VITE_OIDC_AUTHORITY!,
|
||||||
|
client_id: import.meta.env.VITE_OIDC_CLIENT_ID!,
|
||||||
|
redirect_uri: import.meta.env.VITE_OIDC_REDIRECT_URI!,
|
||||||
|
post_logout_redirect_uri: import.meta.env.VITE_OIDC_POST_LOGOUT_REDIRECT_URI!,
|
||||||
|
response_type: 'code',
|
||||||
|
scope: 'openid profile email',
|
||||||
|
loadUserInfo: true,
|
||||||
|
automaticSilentRenew: true,
|
||||||
|
silent_redirect_uri: import.meta.env.VITE_OIDC_SILENT_REDIRECT_URI!,
|
||||||
|
userStore: new WebStorageStateStore({ store: window.sessionStorage }),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (import.meta.env.DEV) Log.setLogger(console)
|
||||||
|
export const userManager = new UserManager(settings)
|
||||||
Reference in New Issue
Block a user