Cross-Origin Resource Sharing (CORS) is a mechanism that allows a web page to make an AJAX call using XMLHttpRequest (XHR) to a domain that is different from the one from where the script was loaded. Such "cross-domain" requests would otherwise be forbidden by web browsers, per the same origin security policy. CORS defines a standardized way in which the browser and the server can interact to determine whether or not to allow the cross-origin request

In Okta, CORS allows JavaScript hosted on your websites to make an XHR to the Okta API with the Okta session cookie. Every website origin must be explicitly permitted via the administrator UI as a "Trusted Origin".

Caution: Only grant access to specific origins (websites) that you control and trust to access the Okta API.

API Support

The Okta API supports CORS on an API by API basis. If you're building an application that needs CORS, please check that the specific operation supports CORS for your use case. APIs that support CORS are marked with the following icon CORS.

Browser Support

Not all browsers supports CORS. The following table describes which browsers support this feature.

IE8 and IE9 do not support authenticated requests and cannot use the Okta session cookie with CORS.

Granting Cross-Origin Access to Websites

You can enable CORS for websites that need cross-origin requests to the Okta API from the Developer Console. Select API > Trusted Origins to see the screen shown below. From the Classic UI, select Security > API > Trusted Origins.

CORS Settings UI

Select Add Origin to specify the base URL of the website that you want to allow cross-origin requests from, then make sure CORS is selected.

Note: If you do not enable CORS, or disable it at a later date, the list of websites is retained.

Add CORS Origin

You can also enable the Redirect setting, which allows for redirection to this Trusted Origin after signing in or out.


Test your CORS configuration:

  1. Grant cross-origin access to
  2. In the same browser in which you have an active session in your Okta organization, enter your Okta subdomain in the form below and click Test. Your Okta user profile displays below the form.

Request Examples

The following code samples can be added to your website to test your CORS configuration. Remember to replace the baseUrl with the URL for your Okta organization.


var baseUrl = 'https://${yourOktaDomain}';
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
    xhr.onerror = function() {
      alert('Invalid URL or Cross-Origin Request Blocked.  You must explicitly add this site (' + window.location.origin + ') to the list of allowed websites in the administrator UI');
    xhr.onload = function() {
    };'GET', baseUrl + '/api/v1/users/me', true);
    xhr.withCredentials = true;
} else {
    alert("CORS is not supported for this browser!")


var baseUrl = 'https://${yourOktaDomain}';
  url: baseUrl + '/api/v1/users/me',
  type: 'GET',
  xhrFields: { withCredentials: true },
  accept: 'application/json'
}).done(function(data) {
.fail(function(xhr, textStatus, error) {
  var title, message;
  switch (xhr.status) {
    case 403 :
      title = xhr.responseJSON.errorSummary;
      message = 'Please login to your Okta organization before running the test';
    default :
      title = 'Invalid URL or Cross-Origin Request Blocked';
      message = 'You must explicitly add this site (' + window.location.origin + ') to the list of allowed websites in your administrator UI';
  alert(title + ': ' + message);

Response Example: Error

If you did not enable CORS, or your CORS configuration is incorrect, you will see an error in your browser's developer tool or JavaScript console:


XMLHttpRequest cannot load https://${yourOktaDomain}/api/v1/users/me. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.


XMLHttpRequest cannot load https://${yourOktaDomain}/api/v1/users/me. Origin https://${yourOktaDomain} is not allowed by Access-Control-Allow-Origin.


Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://${yourOktaDomain}/api/v1/users/me. This can be fixed by moving the resource to the same domain or enabling CORS.

Internet Explorer

SEC7118: XMLHttpRequest for https://${yourOktaDomain}/api/v1/users/me required Cross Origin Resource Sharing (CORS).

SEC7120: Origin https://${yourOktaDomain} not found in Access-Control-Allow-Origin header.

SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

Additional Resources

Featured Guides