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:
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.
The code sample provided by Fei Xue posted here on GitHub has proved successful in authenticating with a Dynamics CRM application hosted in Azure and querying the Web API.
Similar code samples I've used have resulted in 401 Unauthorized
HTTP errors. Why this sample works and others do not remains unanswered for the moment.