@gal_sever/oidc-auth
v1.0.9
Published
For React + Vite
Downloads
1,050
Readme
oidc-auth
For React + Vite
Dependencies
- react
- axios
- react-oidc-context
- oidc-client-ts
To install:
bun install @gal_sever/oidc-authCreate a OIDC Provider Config:
const oidcConfig = {
authority: "authority",
client_id: "clientid",
redirect_uri: "redirect url", // has to match the one in the oidc provider
response_type: "code",
scope: "openid profile email offline_access",
userStore: new WebStorageStateStore({ store: window.localStorage }),
automaticSilentRenew: true,
onSigninCallback: () => {
window.history.replaceState({}, document.title, window.location.pathname);
window.location.replace("/");
}
};Then inside main.tsx add the EasyOidcAuthProvider and the AxiosProvider
createRoot(document.getElementById('root')!).render(
<StrictMode>
<AxiosProvider>
<EasyOidcAuthProvider>
<App />
</EasyOidcAuthProvider>
</AxiosProvider>
</StrictMode>,
)