Fixing Crypto.subtle is available only in secure contexts (HTTPS)
1. Install the polyfill
npm install --save webcrypto-liner-shim3. Import the shim
import { createOidc } from "oidc-spa/core";
if( crypto.subtle === undefined ){
await import("webcrypto-liner-shim");
}
const oidc = await createOidc({
issuerUri: "...",
clientId: "..."
});import { oidcSpa } from "oidc-spa/react-spa";
export const {
bootstrapOidc,
//...
} = oidcSpa
.withExpectedDecodedIdTokenShape({ /*...*/ })
.createUtils();
(async ()=> {
if( crypto.subtle === undefined ){
await import("webcrypto-liner-shim");
}
bootstrapOidc({
implementation: "real",
issuerUri: import.meta.env.VITE_OIDC_ISSUER_URI,
clientId: import.meta.env.VITE_OIDC_CLIENT_ID
});
})();
// ...
Last updated
Was this helpful?