Plaza 365
Plaza 365

No results found for your search

RegisterLog in

5

Visit article

#cds

Dynamics 365 CRM - Development

Category

Jul 12, 2023

Published date

Text

Article Type


AI Summary

  • The article discusses the issue of token expiration when connecting to CDS WEB API from a C# application and suggests a solution.
  • When running long-running processes, the access token acquired to connect to CDS WEB API expires after 1 hour, resulting in an HTTP 400 error.
  • To overcome this issue, the recommended approach is to implement a class derived from DelegatingHandler and pass it to the constructor of the HttpClient.
  • This custom handler will override the HttpClient.SendAsync method, allowing ADAL (Azure Active Directory Authentication Library) to call the AcquireToken method with each request sent by the HttpClient.
  • The article provides code for creating a new class in the project to implement this custom handler.
  • This approach ensures that the access token is automatically refreshed with each request, preventing token expiration and HTTP 400 errors during long-running processes.
  • The code provided in the article can be used to implement this solution in a C# application connecting to CDS WEB API.
  • By implementing this solution, developers can ensure uninterrupted access to CDS WEB API even during long-running processes.

Registered users can view the full text for FREE!

Sign In Now!