Select to view content in your preferred language

How can I tell when a security token times out  -- so I can redirect to a login page.

602
1
08-10-2012 08:15 AM
DirkVandervoort
Frequent Contributor
I am using a token handed to me by the AGS token service to connect to secured AGS services. The token will time out in one hour.

When the token times out, I want the user to be redirected to a login page. Without this redirect, the user would otherwise just get a blank map because the AGS map services don't return a valid map. There does not a property of the map service that tells me that the token has timed out.

The token, being a string, is meaningless, other that it is used as a property of the map service (e.g., appended to the map service URL).

So the question, how can I tell if the token is timed out?

I have enough events that I can routinely troll for a timed-out token - that is if the computational expense is not too great.


--TIA
Tags (2)
0 Kudos
1 Reply
DasaPaddock
Esri Regular Contributor
Are you requesting the token with f=json ? It should return an expires date. If you're sure that it's going to expire in an hour, you could use setTimeout() to either renew the token or redirect to the login in 59 minutes.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#setTimeo...

If using 3.0, you could use the IdentityManager instead:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html
0 Kudos