Select to view content in your preferred language

ArcGIS Online - unattended notebook authentication for multiple organisations - best strategy?

295
1
03-22-2026 04:45 AM
StephenHallett
Occasional Contributor

In ArcGIS Online, the scheduler for notebooks is really handy, and if one uses gis = GIS('home') to authenticate then the notebook runs well as the 'current user'.

My use case though is I need an AGOL notebook that switches between accounts (first running code in the core account and then in the linked community account). I don't want to save passwords in the code.

The options give in https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html seem to either require the password to be hard coded in the script, or use approaches (like profiles) that don't seem appropriate for ArcGIS Online. There are a number of documented authentication approaches, but it isn't clear which is best for AGOL (https://developers.arcgis.com/python/latest/guide/working-with-different-authentication-schemes/).

Profiles would be good approach, but I don't seem to be able to get this working in AGOL. I get error "NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details." I assume keyrings are not possible in AGOL.

What strategies are there for authenticating for unattended notebook runs? Many thanks...

0 Kudos
1 Reply
David_McRitchie
Esri Regular Contributor

Hey Stephen,

Its a very good question and yes fully agreed, avoiding any hardcoding of passwords is the best approach.

For this, I would question the sharing mechanism first, to avoid any need for complexities within Notebooks. Would it be possible to instead have content items required by your automation to be shared via groups, so that an Adminstrator can then just access them with gis = GIS('home')?

Hope that helps,

David

Esri UK -Technical Support Analyst
0 Kudos