Select to view content in your preferred language

Issue attempting OAuth2

1669
2
Jump to solution
02-11-2020 09:18 PM
bobongubza
Emerging Contributor

I am trying to learn how to access services using OAuth2 with javascript.

I am working on the tutorial on this link Access services with OAuth 2.0 | ArcGIS for Developers. Initially, it allows me to sign in (from the sign in link) and provide my arcgis online credentials. Thereafter, I am getting the error below after I have entered my arcgis online credentials.

I followed the steps of creating, registering and providing a redirect uri for the application. I copied the code and changed the portalURL and appid. So I just advice on why I am getting this error

0 Kudos
1 Solution

Accepted Solutions
Noah-Sager
Esri Regular Contributor

Hmm, might be a typo in the code, or perhaps due to the localhost port number?

I just went through the tutorial and it worked for me. Here is the code I used (you'll still need to host it locally and use your client id): https://codepen.io/noash/pen/abOvjZy 

If that doesn't work for you, I would double-check that the exact same url (and port number if used) are used for hosting the app and for the redirect uri.

View solution in original post

2 Replies
Noah-Sager
Esri Regular Contributor

Hmm, might be a typo in the code, or perhaps due to the localhost port number?

I just went through the tutorial and it worked for me. Here is the code I used (you'll still need to host it locally and use your client id): https://codepen.io/noash/pen/abOvjZy 

If that doesn't work for you, I would double-check that the exact same url (and port number if used) are used for hosting the app and for the redirect uri.

bobongubza
Emerging Contributor

You are right, there was a typo in the code I wrote.

Thanks Noah.