I’m working on creating an Outlook Add-in using this architecture.
I’m trying to handle the scenario where Azure Active Directory Access Token expires. According to the official documentation, the token’s life time is 1 hour.
So I was thinking about changing the token’s life time as described in this question. But I cannot do so, as I don’t have the right to edit Azure policies. Also, I believe there is a cleaner way to test this scenario.
How can I test/debug this scenario?
5
Whenever your access token expires you can use your refresh token to exchange for new access/refresh token pair. Refresh token has a maximum inactivity time of 90 days.
You can get refresh token in your result while requesting access token by specifying offline_access in the scope parameter while making the request.
curl --location --request POST 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'client_id={clientid}'
--data-urlencode 'refresh_token={refreshtoken}'
--data-urlencode 'redirect_uri={redirect_uri}'
--data-urlencode 'grant_type=refresh_token'
--data-urlencode 'client_secret={client_secret}'