AnsweredAssumed Answered

Is there a way to look up the expiration of a token?

Question asked by on Aug 27, 2018
Latest reply on Aug 27, 2018 by rscheitlin

I'm using OAuth to access private data on AGOL. Below is the Python code I'm running on my server:


payload = {'client_id': config.UTILISYNC_ESRI_APP_CLIENT_ID, 'refresh_token': refresh_token, 'grant_type': 'refresh_token', 'expiration': 20160}
response =, params=payload)


It executes successfully and I get a token that I can use to access the private AGOL data. However, the expiration I indicated is 2 weeks (20160), but the token expire after 30 or 40 minutes. What happens is I load the private services into my webpage using the Javascript API and the token I received from above. But after 30 or 40 minutes when I pan or zoom and the layer should be refreshed, instead I get an invalid token error on my console and the layer doesn't load.


That is why I would like to know, is there a way I can get the expiration of the token? If I could submit the token to some endpoint and discover that token will actually expire sooner, then I will preemptively refresh the token before that happens.


Also, if anyone has any ideas why my token isn't lasting 2 weeks like I think it should, that would be great to know too!