How can one authenticate and query the Dynamics CRM Web API from a Single Page Application developed with Angular 2 (TypeScript)?
Initial research indicates that:
- The Dynamics CRM (version 2016 or 365) instance needs to be registered as an application in Azure.
- Users can authenticate with Azure-registered applications via Azure AD. Azure provides a client authentication library known as ADAL in JavaScript.
Past efforts involved cloning different Angular 2 repositories utilizing ADAL, like this repository, and modifying their configuration files to connect to my Azure application. However, these attempts consistently resulted in 401 (Unauthorized) cross-domain
errors, which are explained in my separate inquiry.
Interestingly, using the same configuration (e.g. clientId
) outlined in this JavaScript tutorial by Microsoft proved to be successful.