I'm implementing the Microsoft Graph APIs using the Client Credentials Grant Flow, as explained at https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service. Also, the app was registered at https://apps.dev.microsoft.com/.
The aim here is to allow our web application to perform actions like checking the calendars of our users and sending mail on their behalf, without each user being required to authenticate and grant access to the application. The idea is to make it transparent to them.
So I think I've got it working, but wanted to clarify a few things.
- Once the admin consent is granted, does it ever need to be done again if the permissions for the application don't change?
- When requesting an access token, it looks like it expires in an hour. Is there a way to make that longer? Otherwise, what is a typical workflow like to ensure the token isn't expired? Should I be requesting a token each time the application is making an API request to ensure the token is valid? Or perhaps store the token, but get a new one before it expires?