<?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 Using NodeJS app - getting access token from ArcGIS Online in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/using-nodejs-app-getting-access-token-from-arcgis/m-p/1589868#M4954</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am creating simple NodeJS app with express as server. The goal is authorize to ArcGIS online using CLIENT_ID and redirect to /authenticate page to get the access token .&lt;/P&gt;&lt;P&gt;Step 1: Authorization&lt;/P&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;session&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;arcgisRest&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ArcGISIdentityManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;beginOAuth2&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;clientId&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;clientId&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;redirectUri&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;redirecturi&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pcke&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;The session has valid object&amp;nbsp;"id":"MaLBpo4bA9dWkfDvuSN1SWYsGtlh0vkmvUUUPlQ5zU88","originalUrl":"&lt;A href="http://localhost:3000/" target="_blank" rel="noopener"&gt;http://localhost:3000/&lt;/A&gt;"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Step 2:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now, when I use this authorization code to connect to ArcGIS online to get access, the token throws an error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am trying PKCE work flow from&amp;nbsp; :&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/token/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/token/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am encountering various errors, primarily related to invalid PKCE. The issue seems to be with the code_challenge_verifier. I used the appropriate cryptographic library to generate the code challenge, but it still fails with a 400 error.&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a good working sample.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 27 Feb 2025 02:05:03 GMT</pubDate>
    <dc:creator>geo-esri</dc:creator>
    <dc:date>2025-02-27T02:05:03Z</dc:date>
    <item>
      <title>Using NodeJS app - getting access token from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/using-nodejs-app-getting-access-token-from-arcgis/m-p/1589868#M4954</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am creating simple NodeJS app with express as server. The goal is authorize to ArcGIS online using CLIENT_ID and redirect to /authenticate page to get the access token .&lt;/P&gt;&lt;P&gt;Step 1: Authorization&lt;/P&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;session&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;arcgisRest&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ArcGISIdentityManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;beginOAuth2&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;clientId&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;clientId&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;redirectUri&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;redirecturi&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pcke&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;SPAN&gt;The session has valid object&amp;nbsp;"id":"MaLBpo4bA9dWkfDvuSN1SWYsGtlh0vkmvUUUPlQ5zU88","originalUrl":"&lt;A href="http://localhost:3000/" target="_blank" rel="noopener"&gt;http://localhost:3000/&lt;/A&gt;"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Step 2:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now, when I use this authorization code to connect to ArcGIS online to get access, the token throws an error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am trying PKCE work flow from&amp;nbsp; :&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/token/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/token/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am encountering various errors, primarily related to invalid PKCE. The issue seems to be with the code_challenge_verifier. I used the appropriate cryptographic library to generate the code challenge, but it still fails with a 400 error.&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a good working sample.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Feb 2025 02:05:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/using-nodejs-app-getting-access-token-from-arcgis/m-p/1589868#M4954</guid>
      <dc:creator>geo-esri</dc:creator>
      <dc:date>2025-02-27T02:05:03Z</dc:date>
    </item>
  </channel>
</rss>

