<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to use oauth2 authorize in iframe when cross domain in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-use-oauth2-authorize-in-iframe-when-cross/m-p/1561494#M4889</link>
    <description>&lt;P&gt;I am using ArcGIS Enterprise 10.9.1&lt;/P&gt;&lt;P&gt;I have a javascript application that is on another domain than the portal / web adaptor.&lt;BR /&gt;&lt;BR /&gt;I want to authorize that application and display the login form in an iframe but I got the following error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Refused to display '&lt;A href="https://myportaldomain.com/" target="_blank" rel="noopener"&gt;https://myportaldomain.com/&lt;/A&gt;' in a frame because it set 'X-Frame-Options' to 'sameorigin'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In the javascript application I am doing like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;iframe id="my_iframe"&amp;gt;&amp;lt;/iframe&amp;gt;

var myIframe = document.getElementById("my_iframe");
myIframe.setAttribute("src", "https://myportaldomain.com/portal/sharing/rest/oauth2/authorize?client_id=xyz123&amp;amp;redirect_uri=https://myappdomain.com/myapp&amp;amp;display=iframe&amp;amp;response_type=code");

myIframe.onload = function() {
//here I test if the code is available in the iframe url parameters
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have tested this authorization steps when the application is on the same domain than portal and it works.&lt;BR /&gt;&lt;BR /&gt;How can I make it works cross-domain?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2024 13:56:44 GMT</pubDate>
    <dc:creator>MaximeDemers</dc:creator>
    <dc:date>2024-11-25T13:56:44Z</dc:date>
    <item>
      <title>how to use oauth2 authorize in iframe when cross domain</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-use-oauth2-authorize-in-iframe-when-cross/m-p/1561494#M4889</link>
      <description>&lt;P&gt;I am using ArcGIS Enterprise 10.9.1&lt;/P&gt;&lt;P&gt;I have a javascript application that is on another domain than the portal / web adaptor.&lt;BR /&gt;&lt;BR /&gt;I want to authorize that application and display the login form in an iframe but I got the following error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Refused to display '&lt;A href="https://myportaldomain.com/" target="_blank" rel="noopener"&gt;https://myportaldomain.com/&lt;/A&gt;' in a frame because it set 'X-Frame-Options' to 'sameorigin'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In the javascript application I am doing like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;iframe id="my_iframe"&amp;gt;&amp;lt;/iframe&amp;gt;

var myIframe = document.getElementById("my_iframe");
myIframe.setAttribute("src", "https://myportaldomain.com/portal/sharing/rest/oauth2/authorize?client_id=xyz123&amp;amp;redirect_uri=https://myappdomain.com/myapp&amp;amp;display=iframe&amp;amp;response_type=code");

myIframe.onload = function() {
//here I test if the code is available in the iframe url parameters
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have tested this authorization steps when the application is on the same domain than portal and it works.&lt;BR /&gt;&lt;BR /&gt;How can I make it works cross-domain?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 13:56:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-use-oauth2-authorize-in-iframe-when-cross/m-p/1561494#M4889</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2024-11-25T13:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to use oauth2 authorize in iframe when cross domain</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-use-oauth2-authorize-in-iframe-when-cross/m-p/1567025#M4894</link>
      <description>&lt;P&gt;No answer on this?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 21:34:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-use-oauth2-authorize-in-iframe-when-cross/m-p/1567025#M4894</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2024-12-10T21:34:15Z</dc:date>
    </item>
  </channel>
</rss>

