Is there an API that will generate a token using a portal login without a password?

1336
2
Jump to solution
09-16-2022 03:26 PM
FayGlunt
New Contributor III

Is there an API that will generate a token using a portal login without a password?  I do not have an admin account.  I have an account to our AGOL portal, where I login using a URL.  If I am running python on my laptop, I can connect using my ArcGIS Pro, if I stay logged into ArcGIS Pro (It times out from time to time :)).  But, I would like to generate a token using the REST API generate token in Microsoft Power Automate, so I can rerun my survey123 triggers when their tokens expire.  But it requires an username and password.  And, our IT department does not allow us to have an admin account.

https://developers.arcgis.com/rest/users-groups-and-items/generate-token.htm

Right now we are running a python script to reprocess these.  But we need this python script to be running on someone's machine using Task Manager.

This is to reprocess those that get this error:

{"error":{"message":"498: Invalid token.","code":498}}

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AnthonyRyanEQL
Regular Contributor

Fay,

You don't need an admin account to generate a token using the REST endpoint. Any named user account can be used to generate a token which is what happens when the user logs in. The difference will be the content that account has access to & privilege the user can do.

I currently have several named user accounts with various privileges (eg. different role) used for integration/reporting purposes that generate their own tokens to then access content, write data, etc.

 

There is an endpoint that doesn't need a password but needs a registered application within Portal which uses a callback url to exchange keys, etc using OAuth . This can be a little difficult with Python, etc with spinning up a web server to listen on a predefined port and a few other things. I haven't done this before but there examples out there.

Good luck

View solution in original post

2 Replies
AnthonyRyanEQL
Regular Contributor

Fay,

You don't need an admin account to generate a token using the REST endpoint. Any named user account can be used to generate a token which is what happens when the user logs in. The difference will be the content that account has access to & privilege the user can do.

I currently have several named user accounts with various privileges (eg. different role) used for integration/reporting purposes that generate their own tokens to then access content, write data, etc.

 

There is an endpoint that doesn't need a password but needs a registered application within Portal which uses a callback url to exchange keys, etc using OAuth . This can be a little difficult with Python, etc with spinning up a web server to listen on a predefined port and a few other things. I haven't done this before but there examples out there.

Good luck

FayGlunt
New Contributor III

Thank you so much, @AnthonyRyanEQL !  We are actually using this in another tool, and it never crossed our mind.  This is perfect for our use case.  

0 Kudos