I'm interested in using the ArcGIS API for Python to connect to an ArcGIS Online for Organizations account via a token, and not a username/password. All the examples I have found look like this:
from arcgis.gis import GIS
gis = GIS("portal url", "username", "password")
How would I pass a token into this API, instead of username/password?
In case it matters, I want to connect to ArcGIS Online for Organizations, so my user name is <user>_<org_suffix>. My organization does not use an Enterprise Login, so I just log in directly at the Esri site.
Bonus question: I know how to generate the token with Python and the REST API (using JSON). Any idea how to do so with the ArcGIS API for Python?