Select to view content in your preferred language

Using NodeJS app - getting access token from ArcGIS Online

170
0
02-26-2025 06:05 PM
Labels (1)
geo-esri
Emerging Contributor

Hello

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 .

Step 1: Authorization

const session = await arcgisRest.ArcGISIdentityManager.beginOAuth2({
clientId: clientId,
redirectUri: redirecturi,
pcke:true
            });
 
The session has valid object "id":"MaLBpo4bA9dWkfDvuSN1SWYsGtlh0vkmvUUUPlQ5zU88","originalUrl":"http://localhost:3000/"
 
Step 2: 
 
Now, when I use this authorization code to connect to ArcGIS online to get access, the token throws an error
 
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.

 

I am looking for a good working sample. 

 
 
0 Kudos
0 Replies