CORS issue with okta login widget

HI ,We are using okta login widget in our single page angular app but we are getting the below error.My single page app is deployed in ngnix server. I have a developer account set up.I have added the IP in the trusted origins also.still facing the same issue.Please help us here.

Failed to load https://dev-912537.oktapreview.com/api/v1/authn: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘trusted IP’ is therefore not allowed access.
okta-sign-in.entry.js:2835 UnsupportedBrowserError {name: “UNSUPPORTED_BROWSER_ERROR”, message: “There was an error sending the request - have you enabled CORS?”}message: "There was an error sending the request - have you enabled CORS?"name: "UNSUPPORTED_BROWSER_ERROR"proto: Error
at Object. ('trusted IP:40)
at Object. ('trusted IP:98336:4)
at webpack_require ('trusted IP:64324:30)
at Object. 'trusted IP:98989:85)
at webpack_require ('trusted IP:64324:30)
at Object. ('trusted IP:98627:136)
at webpack_require (trusted IP/vendor.js:64324:30)
at Object. 'trusted IP36)
at webpack_require ('trusted IP:30)
at new OktaSignIn (trusted IP/vendor.js:96709:20)
_log @ okta-sign-in.entry.js:2835
error @ okta-sign-in.entry.js:2885
options.globalErrorFn @ okta-sign-in.entry.js:34524
callGlobalError @ okta-sign-in.entry.js:35180
fn.routeAfterAuthStatusChange @ okta-sign-in.entry.js:33825
(anonymous) @ okta-sign-in.entry.js:34558
triggerEvents @ backbone.js:354
triggerApi @ backbone.js:339
eventsApi @ backbone.js:137
Events.trigger @ backbone.js:329
set @ backbone.js:498
set @ okta-sign-in.entry.js:17629
(anonymous) @ okta-sign-in.entry.js:33623
triggerEvents @ backbone.js:352
triggerApi @ backbone.js:339
eventsApi @ backbone.js:137
Events.trigger @ backbone.js:329
(anonymous) @ okta-sign-in.entry.js:33743
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125

thanks
sudhakar

Things to check:

  • http and https may be considered different sites. Make sure the way you’re connecting to your ngnix site matches what you have in your trusted origin
  • Make sure the trusted origin in Okta is of type “CORS”
  • In your error it says “Origin ‘trusted IP’ is therefore not allowed access”. Make sure the “trusted IP” matches exactly what you have in the trusted origin of Okta.

I did all those things but still it’s getting the error.when I tried with localhost:4200 and added that it worked without issues.
Only issue is when I deployed to server and trying to access this issue is coming

Thanks issue got resolved.I have mentioned port in the trusted domain.it was causing the issue.It got resolved now.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.