Token required

35412
19
Jump to solution
07-03-2015 09:53 AM
CatherineBouchard
New Contributor II

Hi,

i want update url of feature on ArcGis Online.

But i have answer:

Token Required.

What can i do, i have to modify some domaine.

Thank you

19 Replies
KellyGerrow
Esri Frequent Contributor

Hi David,

That note is specific to ArcGIS Enterprise but still works for ArcGIS Online.

Ensure that your username and password are in the correct casing and that you are using a post request to generate the token.

Check out this sample which includes using the generate token call to the rest API using python:

https://www.arcgis.com/home/item.html?id=f448101c080d4edb8991fb79da818915 

or:

developer-support/accountHelper.py at master · Esri/developer-support · GitHub 

-Kelly 

0 Kudos
DavidAskov1
Occasional Contributor

Note that I am using ArcGIS Online for Organizations. My connection url is https://{orgname}.maps.arcgis.com/ 

My username is in the form {user}_{orgname} and we use our own user database here (i.e.: I log in with a user/pass that is maintained here at my organization).

I am getting back this response: 

{"error":{"code":400,"message":"Unable to generate token.","details":["Invalid username or password."]}}

Do I need to update the URL, username, and/or referer? 

thanks!

0 Kudos
KellyGerrow
Esri Frequent Contributor

The error message indicates an issue with the username and password. I would check that the case is correct for the username (it isn't case sensitive when logging in through oauth). How are you submitting the request? using python?

-Kelly

0 Kudos
KellyGerrow
Esri Frequent Contributor

Are you using Enterprise Logins?

0 Kudos
DavidAskov1
Occasional Contributor

Hi Kelly. We are on a site license, so I think it's called ArcGIS Online for Organizations. I access it at https://{orgname}.maps.arcgis.com/ and my user name is in the format of {user}_{ORGNAME} noting that the two letters in {ORGNAME} are capitalized.

When I log in to AGOL manually, it sends me to a web page at my organization to authenticate, which is what I think you are referring to as an Enterprise Login. There, my user name that I enter does not have the _{ORGNAME} suffix.

I've tried a bunch of combinations of which URL to send to, variations on my user name, referer, etc. 

I hope this provides some more info that is useful. Any help is appreciated. 

0 Kudos
KellyGerrow
Esri Frequent Contributor

HI David,

It sounds like you are using Enterprise Logins which uses the IDP to verify the username and password through Oauth. Using the Python API or capturing the token in a web debugging program may be the most straight forward way to snag a token.

-Kelly

DavidAskov1
Occasional Contributor

Thanks, Kelly. I tried so many permutations of URL and username that I had reached the end of my rope. I've been grabbing the session out of Chrome Developer Tools which works for prototyping, but I'm trying to automate some server code, so that's not a long-term solution.

It sounds like my next step is to figure out Oauth. Do you know of any clear and concise demos to generate a token that way? Even if it's in .Net or just POST instructions, I can convert that to Python. thanks!

0 Kudos
AdrianWelsh
MVP Honored Contributor

I was coming across this token error as well and tried following some of these instructions and just got lost...

But, what worked for me was, logging into AGOL as an admin, going to the hosted feature layer's page in my Content, and clicking on the "Service URL" link from one of my Layers in the list. 

From there, I was able to see a generated token in my URL 

After that, I inserted "admin/" in between "/rest/" and "services". And I was able to mess with the JSON of the feature service.

LisaCasey
New Contributor III

This worked great for me when I needed to get s token to edit the max record count (using this support documentation: https://support.esri.com/en/technical-article/000012383) ; however, ever since then, enabling/disabling edits no longer functions. I discovered that a layer that should be locked down for editing has been open. Has anyone else noticed this behavior?

0 Kudos
KWilliams
New Contributor III

Hello - I am also receiving the error 'Token Required'. I am replicating a hosted feature layer, I am the owner, and I am the administrator. The replication begins and runs for about 20 minutes, then I get the 'Token Required' error. I am signed in, looking at the URL, I do see a token listed. I've done the thing where I add 'admin' between rest and services but I don't see an option in there to replicate. I have about 300-350 point features but I have a few thousand photo attachments. Is it timing out? I need to create a delivery for a customer so I need to get this figured out asap. Any help would be appreciated. 

 

-Katy