I'm connecting to the Microsoft Graph using:
public GraphServiceClient GetAuthenticatedClient(string token)
{
GraphServiceClient graphClient = new GraphServiceClient(
new DelegateAuthenticationProvider(
async (requestMessage) =>
{
// Append the access token to the request.
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", token);
}));
return graphClient;
}
I'm running this code on the server. The token I'm using is being sent to me by an external App.
Everything works great during the first hour, then the token expires.
My question is : How can I get a new token, since I also have access to the refresh token?