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&client_id=************&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&state=TiM8EYsGY0fZgXAndvPSphHA2LbsDDEnter code obtained on signing in using SAML:
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?