Installation
If you're having issues don't hesitate to reach out on Discord!
Add the lib to your dependencies
npm install oidc-spa
Editing your App entrypoint
This is optional but recommended for better performances and security.
First rename your entry point file from main.tsx
(or main.ts
) to main.lazy.tsx
mv src/main.tsx src/main.lazy.tsx
Then create a new main.tsx
file:
import { oidcEarlyInit } from "oidc-spa/entrypoint";
const { shouldLoadApp } = oidcEarlyInit({
freezeFetch: true,
freezeXMLHttpRequest: true,
freezeWebSocket: true
});
if (shouldLoadApp) {
// Note: Deferring the main app import adds a few milliseconds to cold start,
// but dramatically speeds up auth. Overall, it's a net win.
import("./main.lazy");
}
Last updated
Was this helpful?