I'm using access and refresh token to do some Microsoft graph queries. When the access token expires, I do the standard token refresh procedure using the refresh token. When I make a query using an expired token, I get the following error:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken validation failed with reason code: 80049228.",
"innerError": {
"request-id": "f4853bd8-1cf1-44eb-b4a6-b3c695223762",
"date": "2019-09-05T17:39:42"
}
}
}
I've wrapped a query in a try/catch, and when I get an error I'm comparing the message, as InvalidAuthenticationToken can be found in more cases than just expiration. Is there a better way to check for access token expiration? Is there a reason the error code number itself isn't exposed?