Select to view content in your preferred language

Generating token for ArcGIS Online hosted service

30719
22
Jump to solution
02-26-2018 10:16 PM
SteveOchieng
New Contributor III

Hi guys,

I'd like to generate token for arcgisonline hosted service but I can figure out the endpoint and how to construct the request.

Is ithttps://www.arcgis.com/sharing/rest/generateToken?username=username&password=password&expiration=60 ...

What is the endpoint and how would I construct the parameters. I'm using Java HttpUrlConnection? #ArcGISREST

22 Replies
ArthurXiao
New Contributor II

Thanks again for the explanation. So now goes back to the beginning question: 

Generated token with https://www.arcgis.com/sharing/generateToken, then query service hosed by  https://services3.arcgis.com/ViXXHj2TcfxwEXHV/arcgis/rest but got failed message "Invalid Token".

So I think it's the problem of AGOL.

0 Kudos
iHack
by
New Contributor III

@ArthurXiao  

I'm not sure if this will help you; but, I had a similar issue that was resolved by setting the client parameter to referer; and setting the referer parameter to my feature service's base URL, which in your case may be  https://services3.arcgis.com/ViXXHj2TcfxwEXHV.

This reference was useful for me:

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

0 Kudos
iHack
by
New Contributor III

Hello @ArthurXiao ,

Have you been able to resolve this issue?  I'm having a similar, if not the same, issue.

 

Do you think the ArcGIS Online security settings for the user whose credentials are being used to generate the token have anything to do with this.  For example, do they need to be an administrator?

0 Kudos