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("https://pythonapi.playground.esri.com/portal", 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: https://pythonapi.playground.esri.com/portal/sharing/rest//oauth2/authorize?response_type=code&clien...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 pythonapi.playground.esri.com is coming from my office server. But then I'm clicking on the link from my chromebook at home, so THAT request arriving at pythonapi.playground.esri.com 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?
Help!
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
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 "https://my-organization.maps.arcgis.com/sharing/rest/oauth2/authorize?...", whereas the one that I'm usually directed to upon logging into ArcGIS online begins "https://my-organization.maps.arcgis.com/sharing/oauth2/authorize?..."
Are there any updates to this topic, or can anyone help?