I have created a simple angular spa project where I use ng2-adal library for authentication and authorization. The library has a method acquireToken that returns a single token for a single endpoint you have specified in its parameter and that works fine. I use it to make REST API calls. As I have multiple API endpoints I need to define an array of those endpoints for which a single token will be generated that I will use for all my REST API calls.
1 Answers
1
votes
You cannot call multiple APIs using the same Access Token .A single access token issued by azure ad is for a certain resource/api endpoint . When API receives an Access Token, it will verify that the audience value is correct and reject any tokens intended for a different audience.
ADAL for JavaScript will help you get token for different resource , you should firstly config the endpoints property . When acquiring token for different resource , ADAL JS uses a hidden iframe to drive a UX-less authentication that leverages the presence of that cookie to get new tokens from Azure AD via implicit flow.