Thank you for your post and I apologize for the delayed response!
Error Message: InvalidAuthenticationToken - Lifetime validation failed, the token is expired.
I understand that you created an application with the appropriate permissions and when using the MS Graph API, after a period of 5-6 days, you're running into the error message above. To hopefully help point you in the right direction or resolve your issue, I'll share my findings below.
Findings:
From the error message that you received; this is indicating that the user's authentication token has expired, which can happen if the token isn't refreshed in a timely manner. For more info.
To resolve this, please try refreshing the authentication token before making your API call. Additionally, you can also check the expiration time of the token and make sure to refresh it before it expires.
Additional Links:
- 401 Unauthorized error: Is your token valid?
- Resolve Microsoft Graph authorization errors
- Access, ID, and SAML2 token lifetime policy properties
- Token lifetime policies for access, SAML, and ID tokens
I hope this helps!
If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.
If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.