Token Substitution
Enabling the defence
import { defineConfig } from "vite";
import { oidcSpa } from "oidc-spa/vite-plugin";
export default defineConfig({
plugins: [
// ...
oidcSpa({
// ...
tokenSubstitution: {
enabled: true,
// Optional, see below
trustedThirdPartyResourceServers: [
"s3.amazonaws.com",
"*.microsoft.com"
]
}
})
]
});import { oidcEarlyInit } from "oidc-spa/entrypoint";
import { enableTokenSubstitution } from "oidc-spa/token-substitution";
const { shouldLoadApp } = oidcEarlyInit({
// ...
extraDefenseHook: () => {
enableTokenSubstitution({
// Optional, see below
trustedThirdPartyResourceServers: [
"s3.amazonaws.com",
"*.microsoft.com"
]
});
}
});
if (shouldLoadApp) {
import("./main.lazy");
}Understanding the defence
const accessToken = await oidc.getAccessToken();What this blocks
How requests still work
Compared to DPoP
Requirements (can I enable it?)
trustedThirdPartyResourceServers
What’s allowed by default
Last updated
Was this helpful?