I am making requests to the Microsoft Graph REST api (beta), specifically to the sign-in event endpoint: https://graph.microsoft.com/beta/auditLogs/signIns
I am making batch requests that retrieve sign-ins for a particular user in batches of 1000. Starting around the 25th of september, these requests would fail after roughly 10-50 batches, with the following response, with a 400 (Invalid Request) HTTP error code:
"error": {
"code": "",
"message": "Token not found: token is either invalid or expired",
"innerError": {
"request-id": "[request-id-redacted]",
"date": "2019-09-30T22:27:36"
}
}
However, if I retry the requests after waiting ~1s, with the very same JWT web token, the requests succeed and I'm able to complete all the batch requests for the job I'm running. The access token I receive when initially authenticating expires in 1 hour, but this error crops up ~1-15 minutes after I receive the token (I've confirmed the unix timestamp expiry date I get w/ the token).
I'm wondering what could be the cause of this error, and how I could avoid it, other than hard-coding the specific response message and retrying. I was unable to find any matches on google for the error message, either. Has anyone seen this error before from the Microsoft Graph API?