Unity WebGL CORS problem

Hi there,

I’m currently using Okta to authenticate users with their email and password using Unity’s Native UI with the help of https://developer.okta.com/docs/reference/api/authn/. (Public App Example)

This worked on both PC and Mobile platforms however when ported to WebGL I would get the error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at {domain}/api/v1/authn. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). (Firefox link)

I’ve done some searching on my own and found that the /api/v1/authn does not support CORS, how would I get around this problem?

Being a game developer I’m very much not familiar with this and Http in general so any help would be greatly appreciated.

I am pretty sure /api/v1/authn supports CORS. Do you have the origin url added to the list of Trusted Origins in Okta? For example, my test app is running on http://localhost:8080 so I would add http://localhost:8080 as a trusted origin in Okta. You can find the setting under Security -> API in the Classic UI.