AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 374 forks source link

Token cookie does not appear to be added to outbound WebAPI calls #825

Closed CodeWarrior-Hawaii closed 5 years ago

CodeWarrior-Hawaii commented 5 years ago

I have authentication working in my angular app as evidenced by the successful login and the presence of the Token string in the address bar (there a good way to get rid of that?).

I do not however see the token being added to outbound webapi calls resulting in 401 errors (I marked a whole controller [Authorize] to test). Both the Angular app and my WebAPI application are running on my local machine for the moment. Is there some interceptor setup that I need to do?

navyasric commented 5 years ago

@CodeWarrior-Hawaii You can enable the option for adal-angular to intercepts the requests to web apis and attach the tokens to the calls by setting the $httpProvider at config time. In order to specify which APIs endpoints to attach tokens to you can use the endpoints mapping. Please take a look this pattern explained in this wiki as well as the sample linked on that page. Closing for now.