How do you authenticate with and query the Dynamics CRM Web API from within a SPA built using Angular 2 (TypeScript)?
Research so far has suggested that:
- the Dynamics CRM (version 2016 or 365) instance must be registered as an application in Azure.
- users can authenticate with Azure-registered applications via Azure AD. Azure has a client authentication library called ADAL written in JavaScript.
My attempts so far have involved cloning various Angular 2 repos built with ADAL, such as this one, and editing their configuration files to point towards my Azure application. These attempts have all resulted in 401 (Unauthorized) cross-domain
errors which is detailed in my separate question.
Using the same configuration (e.g. cliendId
) in this JavaScript walk-through from Microsoft is successful.