Select to view content in your preferred language

OAuth 2.0 authentication for Python API

10-02-2020 02:31 PM
New Contributor II

I'm having some trouble getting a Python script authenticated via the OAuth 2.0 method described here:
Working with different authentication schemes | ArcGIS for Developers 

Following those instructions, I've created a Python App in my organization.  My script then does:

from arcgis.gis import GIS
gis = GIS("", client_id='************')

(Obscuring the client_id so as not to expose my organization to the whole world!)
Output (in Jupyter Notebook) is this: (note I've replaced the client_id in the url below with '**********'

Please sign in to your GIS and paste the code that is obtained below. If a web browser does not automatically open, please navigate to the URL below yourself instead. Opening web browser to navigate to:
Enter code obtained on signing in using SAML: 

I click on the link and get this in my browser:

What's going wrong?

(By the way, I recognize that it may be impossible to troubleshoot without sharing the client_id.  If that's the case...oh well!)

One possibility: I'm running jupyter notebook on a (headless) server in my office at work.  But I'm accessing the server from my chromebook at home.  So when the script executes, the request being sent to is coming from my office server.  But then I'm clicking on the link from my chromebook at home, so THAT request arriving at from a different IP and a different machine.  Perhaps this causing some kind of mis-match in the request headers (the one from the script vs the one from the browser) that causes the "Invalid client_id" error?


Tags (1)
2 Replies
New Contributor II

Similar Q here.  Did you find a solution?
Want to deploy some python scripts using ArcGIS API for Python onto Lambda, and leverage client_id

New Contributor II

I also have a similar question.

The exact same thing happens to me that happens to @StuartJordan , and I noticed that the URL my Python script directs me to begins with "", whereas the one that I'm usually directed to upon logging into ArcGIS online begins ""

Are there any updates to this topic, or can anyone help?

0 Kudos