forked from baron/baron-sso
21 lines
864 B
TypeScript
21 lines
864 B
TypeScript
import { UserManager, WebStorageStateStore } from "oidc-client-ts";
|
|
import type { AuthProviderProps } from "react-oidc-context";
|
|
|
|
export const oidcConfig: AuthProviderProps = {
|
|
authority: import.meta.env.VITE_OIDC_AUTHORITY || "http://localhost:5000/oidc", // Gateway Proxy URL
|
|
client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "devfront",
|
|
redirect_uri: `${window.location.origin}/auth/callback`,
|
|
response_type: "code",
|
|
scope: "openid offline_access profile email", // offline_access for refresh token
|
|
post_logout_redirect_uri: window.location.origin,
|
|
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
|
automaticSilentRenew: true,
|
|
};
|
|
|
|
export const userManager = new UserManager({
|
|
...oidcConfig,
|
|
authority: oidcConfig.authority || "",
|
|
client_id: oidcConfig.client_id || "",
|
|
redirect_uri: oidcConfig.redirect_uri || "",
|
|
});
|