0

I have an Angular frontend app and a web api. For my Angular, I'm using Msal.js for authenticating. It's working already, I get redirected to Microsoft login page then I get the user details and the token.

The problem is even when I use the token as Authorization: Bearer '{my token}' header, the Web API still returns a 401 Unauthorized error.

I've used this guide for my web api authentication. All my apps are still local.

1 Answer 1

2

Sorry. The Azure AD V2 endpoint (which msal uses) does not support yet getting a token for a Web API which is different than your web application.

If this is an option for you to have your Angular frontend being the same App as your WebAPI, I suggest you have a look at https://github.com/Azure-Samples/active-directory-javascript-singlepageapp-dotnet-webapi-v2.

Otherwise, if this is not suitable, I'd advise you to wait a bit: we expect the missing capability to be available soon.

Sign up to request clarification or add additional context in comments.

1 Comment

It's okay now, my web app is inside my web api I got it working now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.