Authentication problem: can't access proprietary Arcgis portal

11-30-2020 05:24 AM
New Contributor II

Hi all

I am currently developping a MFC application that loads html and javascript code, using the Arcgis javascript api (4.17), to display a map, where I am adding feature and graphic layers. I must as well add that I am not using the ArcGIS Web AppBuilder. All good until now and I want now to upload these data/feature layers on a specific proprietary Arcgis portal. The authentication pattern I am trying to develop is the named user login workflow.

I tried thus to follow this tutorial and use the code provided by it:
My application is registered on the proprietary Arcgis account and I have its client/application ID.
As many, I have this "redirect_uri" error displayed when I am launching my application and try to sign in, and even when I am naively double click on the unmodified identity-oauth-basic.html file provided by the aforementioned tutorial. Following that, I got a bit confused with what I can find on the net to solve this problem.

From what I gathered from the net, I understand that I need to specify on the Arcgis portal the URL of the page users of my app are redirected to after they successfully log in.
But in my case, everything is local and I am basically embedding a html file through my application. Thus I don't know what to specify as a "redirect url" in the "Authentication" pane of the registered application on the Arcgis account.
I tried to add "http://localhost/" and "https://localhost/" as some tutorials and forum posts may specify it, but the problem is still here. I wouldn't actually know what I should type in a web browser to point to my html file, except from its absolute path.
I added as well as a "redirect url" the address I am specifying in my OAuthInfo instance. Here as well I am getting confused about the different specified urls. The proprietary portal url I am trying to work with has the following format: https://<company name> But some urls are specified with the '/arcgis' (redirects to a non-found page in my case) at the end and the aforementioned tutorial is even adding the '/sharing' extension (redirects to a page where I can be redirected to the Arcgis API reference). What are the conventions here and what should I use in my OAuthInfo instance and on the application authentication settings?

Can someone clarify these different points and help move forward with this authentication problem? Thanks a lot in advance.

0 Kudos
4 Replies
Frequent Contributor II

What is the URL for your application when you run it locally? Is it http://localhost or is there a port, like http://localhost:3333?


You can add the redirect with a wildcard in your item like http://localhost:3333/* or http://localhost/* see if that helps.

0 Kudos
New Contributor II

My application has a resource folder where from the html/javascript code is located and executed. When I open the html file, including my html and javascript code, with a web browser, I only see the absolute path of the file in the address bar. I am never using explicitely a URL.

0 Kudos
Esri Contributor

You could try adding the machine name that is running the application as the redirect_uri. For instance, if the application is running off of a server named, you could specify and 

Also, it might be helpful to understand the purpose of the redirect_uri: "Redirect URIs are valid addresses that users of your app can be redirected to after they successfull..." Say that you are accessing the application using a certain URL ( After clicking the sign-in button in your app, the OAuth process should take you to your portal sign-in page. After signing-in, you will be redirected to the initial URL ( As long as you have the proper redirect_URI set (in the example,, you should be redirected properly from the portal sign-in page back to your application URL.

0 Kudos
New Contributor II

The application is a c++ application running locally on a dedicated computer. It is not running off of a specific server.
I talked about "proprietary" portal but "private" may have been a better adjective. This arcgis portal is managed by another company. I am trying to upload a feature layer I am creating locally through my application on this portal.
The OAuth process should allow me to log in to this arcgis portal so that I can uploade data on it.

0 Kudos