Select to view content in your preferred language

how to use oauth2 authorize in iframe when cross domain

418
1
11-21-2024 01:26 PM
Labels (1)
MaximeDemers
Frequent Contributor

I am using ArcGIS Enterprise 10.9.1

I have a javascript application that is on another domain than the portal / web adaptor.

I want to authorize that application and display the login form in an iframe but I got the following error:

Refused to display 'https://myportaldomain.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

In the javascript application I am doing like this:

 

 

<iframe id="my_iframe"></iframe>

var myIframe = document.getElementById("my_iframe");
myIframe.setAttribute("src", "https://myportaldomain.com/portal/sharing/rest/oauth2/authorize?client_id=xyz123&redirect_uri=https://myappdomain.com/myapp&display=iframe&response_type=code");

myIframe.onload = function() {
//here I test if the code is available in the iframe url parameters
};

 

 


I have tested this authorization steps when the application is on the same domain than portal and it works.

How can I make it works cross-domain?

0 Kudos
1 Reply
MaximeDemers
Frequent Contributor

No answer on this?

0 Kudos