.NET SDK - Handling expired tokens

I’m using the .NET Management SDK and have it working using a test token. I want to handle expired tokens, but how can I tell a token has expired after I’ve made a request? Is a certain exception thrown? I can’t seem to see a property on client to check after a request has occurred.

Thanks

As part of the response to the request that obtained the access token an expires_in property would be returned containing the expiration in seconds for that access token. You could store and then use that to guide your application in terms of when an access tokens needs to be renewed.

Alternatively, you can also react to a 401 response from the Management API as a signal that the access token you have is no longer valid and as such proceed to obtain a new one.

1 Like

After posting the original message I actually did implement the expiry and renew tokens based on that. I just didn’t appear to be clear as to what happens if you don’t manage it yourself. I assume an exception is thrown and handle it there also.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.