Hi, I have followed the instruction in Sign in to your SPA with the embedded Okta Sign-In Widget | Okta Developer to integrate the sign in widget in my SPA.
And I have also added the trusted origin as https://xxxx.com
Yet I’m still receiving CORS error:
Access to fetch at ‘https://xxx.okta.com/oauth2/default/v1/interact’ from origin ‘https://www.xxx.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
What could I do to resolve this error? does the www prefix matter when adding trusted origins?
My Okta Config:
export const config: OktaConfig = {
oidc: {
issuer: ‘issuer /oauth2/default’,
clientId: ‘some client id’,
scopes: [‘openid’, ‘profile’, ‘email’],
redirectUri: ${window.location.origin}/login/callback
},
widget: {
issuer: ‘issuer /oauth2/default’,
clientId: ‘some client id’,
scopes: [‘openid’, ‘profile’, ‘email’],
redirectUri: ${window.location.origin}/login/callback
useInteractionCodeFlow: true
}
};
Okta sign in widget related package version:
“@okta/okta-auth-js”: “^6.5.0”,
“@okta/okta-react”: “^6.4.3”,
“@okta/okta-signin-widget”: “^6.3.1”,