Authenticate an EWS WCF service by using OAuth and refresh access token

Manoj Patel 21 Reputation points

I am trying to call Exchange web services (EWS) end points from my WCF service using OAuth authentication.
I have registered the app on Azure portal and able to generate and authenticate it using access token.

My question is about how I can refresh the token in WCF service. It seems access token has an hour validity.

 //Code to generate access token  
// Using Microsoft.Identity.Client 4.22.0  
//Get a token with app-only auth  
var cca = ConfidentialClientApplicationBuilder  
// The permission scope required for EWS access  
var ewsScopes = new string[] { "" };  
//Make the token request  
var authResult = await cca.AcquireTokenForClient(ewsScopes).ExecuteAsync();  

Followed below link for this.


Windows Communication Foundation
Windows Communication Foundation
A Microsoft runtime and set of application programming interfaces in the .NET Framework for building service-oriented applications.
273 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
340 questions
{count} votes