ArcGIS Online generated token is invalid

219
1
03-26-2021 09:23 AM
ArthurXiao
New Contributor II

We can get token with https://www.arcgis.com/sharing/generateToken by POST method and following format of parameters:  f=json&username=USERNAME&password=PASSWORD&client=requestip

But when use that token to query a hosted Survey123 result feature service on https://services3.arcgis.com, got following error: {"error":{"code":498,"message":"Invalid token.","details":["Invalid token."]}}

Any idea? 

0 Kudos
1 Reply
HasheenDeBerry
New Contributor III

Arthur,

I don't know if this will help you, but I thought I'd take a shot anyways.

The query string parameters for your token request, specifically the 'client=requestip' part I believe binds that token to the IP address that made the request.  If you're using that token from a different machine, that may contribute to your error.  Have you tried making a token request using a referer?  I do this all the time and its effective for my workflows.  Instead of 'client=requestip' you would use 'client=referer&referer=<some url>'.  Be sure that when you're querying your Survey123 feature service that the web request uses that same referer URL or you will be back where you started.

Full disclosure, I don't use Survey123, but I did write a Windows service that syncs my company's proprietary geospatial data with ArcGIS Online's feature services.

I hope this helps.

 

Cheers.

 

0 Kudos