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.
What is the endpoint and how would I construct the parameters. I'm using Java HttpUrlConnection? #ArcGISREST
Solved! Go to Solution.
Did you ever solve this - getting the same issue.
Thank you @RamunasKraujutis for your post and I can generate token now, but the token is cut off which is shorter than the one got from URL after sign in , so when use it to query got failed message "Invalid Token". So do you know why the token is cut off? Thanks.
Hello @RamunasKraujutis,
I was referred to this thread by @IsmaelChivite.
I'm trying this method in order to obtain a token; so, I may update a feature layer in Make (formerly Integromat). I seem to be getting a token in the output data of my generateToken request; however, I would like to know how to pass the token generated from this output to my updateFeatures HTTP Make a request module.
I selected the output Data field from the generateToken request to be used as the token field value in the subsequent updateFeatures request; but, it seems to insert the full response with all of the parameters from the generateToken request. I just need to pull the one token parameter from the previous generateToken request into the token field for the following updateFeatures request.
Does anyone know how this can be done?
Thanks
@RamunasKraujutis I selected the Parse response (fig. 1) in the generateToken request. It is now pulling the token into the updateFeature token field input; however, I'm getting an error for the output (fig. 2):
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?
I was able to resolve this issue of receiving the error code {"error":{"code":498,"message":"Invalid token.","details":["Invalid token."]}} in Make [formerly known as Integromat], which is mentioned by others in this thread; but, I had not seen a resolution for it.
Methodology:
The main thing that made a difference for me in generating a token that would not cause the error was to set the client parameter to refer instead of requestip; then set the refer parameter to the base URL of the feature layer that I'm updating.
I can get the token, but when I try to use it for actions like adding to a feature layer (applyedits) it keeps saying,
{"error":{"code":498,"message":"Invalid token.","details":["Invalid token."]}}
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
@ArthurXiaoif you generated your token from one IP address and trying to use from different IP address, then it's normal, that you get "Invalid token" error. Also, there is no problem with "." (dot) at the end of token.
Please see documentation at https://developers.arcgis.com/rest/users-groups-and-items/generate-token.htm and check other options when generating token.
Thank you for your response.
I used "requestip" for parameter "client", so looks is not the problem of client IP. Do you mean I requested token from "https://www.arcgis.com/sharing/rest/generateToken?" but used to query service on "https://services3.arcgis.com/ViXXHj2TcfxwEXHV/arcgis/rest/services/"?
If that's the case, then how to request token from "https://services3.arcgis.com"? I tried
https://services3.arcgis.com/sharing/rest/generateToken?
https://services3.arcgis.com/generateToken?
https://services3.arcgis.com/sharing/generateToken?
But none of them works.
The link you pointed to is for portal, but we tried to get token from ArcGIS online.
Any idea will be appreciated.
"/rest/info?f=json" (in your case - https://services3.arcgis.com/ViXXHj2TcfxwEXHV/arcgis/rest/info?f=pjson ) gives information where tokens should be generated (https://www.arcgis.com/sharing/generateToken).