Generated Tokens not lasting

1122
5
01-08-2013 04:07 AM
DanikBourdeau2
New Contributor III
Hello,

I keep generating tokens here 'https://www.arcgis.com/sharing/generateToken?' without any problems.  I then use the token to load Feature Services hosted from ArcGIS Online in my web app.  The problem is that the tokens never seem to last the length I specify in the url, ie.expiration=1440.

It doesn't seem to matter what I put down, 365 days, 6 months or 10 days the token works only once it seems.  Am I not understanding how tokens work?  I thought that by setting the expiration to 1440 the token would be good for 10 days?

Thanks
0 Kudos
5 Replies
HemingZhu
Occasional Contributor III
Hello,

I keep generating tokens here 'https://www.arcgis.com/sharing/generateToken?' without any problems.  I then use the token to load Feature Services hosted from ArcGIS Online in my web app.  The problem is that the tokens never seem to last the length I specify in the url, ie.expiration=1440.

It doesn't seem to matter what I put down, 365 days, 6 months or 10 days the token works only once it seems.  Am I not understanding how tokens work?  I thought that by setting the expiration to 1440 the token would be good for 10 days?

Thanks


1440 would be 1 day (24X60). not 10 day.
0 Kudos
DanikBourdeau2
New Contributor III
True, 10 days should be 14400.  Now you have me wondering if I dropped a zero in my urls.

I'll regenerate another token and see how I go.  I take it from your response though that tokens should last the length of their expiration regardless of how many times they are used?  Also does anybody know the maximum length token can be generated for?  In my experience it seems like two weeks is the max.
0 Kudos
MattLane
Occasional Contributor II
The default maximum length is 1 day (1440). https://sampleserver6.arcgisonline.com/arcgis/admin/www/doc/tokenManager.html

The longTimeout (up to 1 year, 525600) property can be configured and so each server you access may have a different max age.
0 Kudos
DanikBourdeau2
New Contributor III
@Matt  Thanks for the link

I've had much better luck lately; been using the same token now for quite a few days.  Judging from the expiration time stamp that is returned it looks like the maximum length for a token from ArcGIS Online is two weeks.

I think the problem that I was having was because I was constantly generating new tokens rendering the old ones void.  I would generate a token and use it one app then generating a new token using it in a different app.  When I would go try the first app the token wouldn't work anymore.

I guess you can only have one valid token per user at one time?
0 Kudos
ThomasGagne
New Contributor II

Interesting, but I don't get how I /use/ a token.  I have one, and now need to access a layer via HTTPS.

Adding &token=crazylongstringwithlotsofcharacters to the URL doesn't seem to cut it, but I haven't found in the documentation where else to put it.

For instance, I believe that once I have a token, I should be able to to into an anonymous/incognito browser window and enter the layer URL I would like to fetch and supply the token somewhere to fetch it.

0 Kudos