I created a python toolbox with the following code:
from arcgis.gis import GIS
gis = GIS("my portal url", client_id='my client id')
When I run the toolbox, a browser pops up with a OAuth2 Approval code which is expected. (see screenshot).
The question is how can I paste that code back into my running toolbox?
Hi
I am wondering, because you are working with a Python toolbox geoprocessing tool then the tool doesn't allow you to paste that approval code back into the tool.....
so...
Do you use the same account to log into ArcGIS Pro? If so could you use the "pro" option to pass into the GIS class as authentication has already been achieved?
So:
gis = GIS('pro')
And so everytime you use SSO to access ArcGIS Pro then your tool will automatically use those SSO credentials.
Would that be useful?
Many thanks ed
You're suggestion solves part of the problem. But if the user isn't logged into our portal than that suggestion doesn't work. I ultimately used the client_secret parameter in my GIS call.
So my code looks like this now.
gis = GIS(portal, client_id=clientId, client_secret=clientSecret)
Hi
Many apologies for not replying sooner. I'm glad that you found a solution which works for you - great job!
ed