Dynamics CRM Web API C# Auto Refresh Access Token while performing API request to CDS


The recommended approach to overcome the HTTP 400 error when the access token expires while connecting to CDS WEB API from a C# application is to implement a class derived from DelegatingHandler. This handler will allow you to override the HttpClient.SendAsync method so that ADAL will call the AcquireToken method with each request sent by the http client. The article provides step-by-step instructions on how to create a new class in your project and add the necessary code.


Article 21m

Login now to access my digest by 365.Training

Learn how my digest works
Features
  • Articles, blogs, podcasts, training, and videos
  • Quick read TL;DRs for each item
  • Advanced filtering to prioritize what you care about
  • Quick views to isolate what you are looking for right now
  • Save your favorite items
  • Share your favorites
  • Snooze items you want to revisit when you have more time