<?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 Re: How to X-Esri-Authorization header for get request in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1274829#M22958</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to modify the code to include the token in the header.&lt;/P&gt;&lt;P&gt;for example, OAuth2 or ArcGIS token authentication, here the exmaple javascript&lt;/P&gt;&lt;P&gt;esriRequest(url, {&lt;BR /&gt;query: {&lt;BR /&gt;// Set any query parameters here&lt;BR /&gt;},&lt;BR /&gt;headers: {&lt;BR /&gt;"X-ESRI-Authorization": "Bearer " + token&lt;BR /&gt;}&lt;BR /&gt;}).then(function(response) {&lt;BR /&gt;// Handle the response here&lt;BR /&gt;}).catch(function(error) {&lt;BR /&gt;// Handle any errors here&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;You need to replace url with the URL of the resource you want to access, and token with the token you retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2023 18:02:39 GMT</pubDate>
    <dc:creator>Omar_A</dc:creator>
    <dc:date>2023-04-03T18:02:39Z</dc:date>
    <item>
      <title>How to X-Esri-Authorization header for get request</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1268306#M22935</link>
      <description>&lt;P&gt;Hi All, i want to hide the token passed as a query parameter in every map request. The Web App Builder application is querying arcgis portal for resources passing the token every time. I need to hide this token from the query parameter. I found that ESRi has suggested to send the token in the X-ESRI-Authorization header instead of as query parameter in the below link&lt;/P&gt;&lt;P&gt;[Access ArcGIS token-secured web services—ArcGIS Server Administration (Windows) | Documentation for Ar...](&lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/windows/accessing-arcgis-token-secured-web-services.htm" target="_blank"&gt;https://enterprise.arcgis.com/en/server/latest/administer/windows/accessing-arcgis-token-secured-web-services.htm&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly let me know how to configure the JavaScript application to send the token in the&amp;nbsp;&lt;SPAN&gt;X-ESRI-Authorization header instead of as query parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hari&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 21:41:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1268306#M22935</guid>
      <dc:creator>HariKrishnaInukollu</dc:creator>
      <dc:date>2023-03-15T21:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to X-Esri-Authorization header for get request</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1274829#M22958</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to modify the code to include the token in the header.&lt;/P&gt;&lt;P&gt;for example, OAuth2 or ArcGIS token authentication, here the exmaple javascript&lt;/P&gt;&lt;P&gt;esriRequest(url, {&lt;BR /&gt;query: {&lt;BR /&gt;// Set any query parameters here&lt;BR /&gt;},&lt;BR /&gt;headers: {&lt;BR /&gt;"X-ESRI-Authorization": "Bearer " + token&lt;BR /&gt;}&lt;BR /&gt;}).then(function(response) {&lt;BR /&gt;// Handle the response here&lt;BR /&gt;}).catch(function(error) {&lt;BR /&gt;// Handle any errors here&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;You need to replace url with the URL of the resource you want to access, and token with the token you retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 18:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1274829#M22958</guid>
      <dc:creator>Omar_A</dc:creator>
      <dc:date>2023-04-03T18:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to X-Esri-Authorization header for get request</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1352466#M23291</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/628209"&gt;@Omar_A&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I'm trying to send a request from AGOL map viewer to geoserver to bring in a WMS. My logged-in AGOL user is federated using Okta and Geoserver is also federated with the same Okta IdP instance. Is there anyway that I can send the bearer/token with the WMS request header so Geoserver can recognise it and doesn't ask for username and pass?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 12:42:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1352466#M23291</guid>
      <dc:creator>Hal-AhmedShehata</dc:creator>
      <dc:date>2023-11-22T12:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to X-Esri-Authorization header for get request</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1518207#M23557</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am Alex. I am not an expert in this but is it possible to do it with interceptors (previously with a token) with something like this:&lt;/P&gt;&lt;P&gt;esriConfig.request.interceptors.push({&lt;BR /&gt;// interceptar todas las solicitudes&lt;BR /&gt;urls: ["&lt;A href="https://services5.arcgis.com/" target="_blank" rel="noopener"&gt;https://services5.arcgis.com/&lt;/A&gt;"],&lt;BR /&gt;&lt;BR /&gt;before: function(params) {&lt;BR /&gt;console.log("Interceptando solicitud:", params.url);&lt;/P&gt;&lt;P&gt;// Agregar un encabezado personalizado&lt;BR /&gt;params.requestOptions.query = params.requestOptions.query || {};&lt;BR /&gt;params.requestOptions.query.token = token;&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;after: function(response) {&lt;BR /&gt;console.log("Interceptando respuesta:", response);&lt;/P&gt;&lt;P&gt;// Manejar la respuesta aquí si es necesario&lt;BR /&gt;return response;&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;error: function(error) {&lt;BR /&gt;console.error("Error en la solicitud:", error);&lt;/P&gt;&lt;P&gt;// Manejar errores aquí si es necesario&lt;BR /&gt;return Promise.reject(error);&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;It gives as an error:&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Crossed origin request blocked. Same origin policy is not allowed in remote resources in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A title="" href="https://services5.arcgis.com/sqfMQWqBYN9VALtB/arcgis/rest/services/LimitesPaises_DEV/FeatureServer?f=json" target="_blank" rel="noopener noreferrer"&gt;https://services5.arcgis.com/xyzxyz/arcgis/rest/services/xyzxyzx/FeatureServer?f=json&lt;/A&gt;&lt;SPAN class=""&gt;. (‘x-esri-authorization’ header not permited in header ‘Access-Control-Allow-Headers’ previous verification of CORS response).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 08:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-x-esri-authorization-header-for-get-request/m-p/1518207#M23557</guid>
      <dc:creator>alegarma_dev</dc:creator>
      <dc:date>2024-08-12T08:10:17Z</dc:date>
    </item>
  </channel>
</rss>

