MSAL v2 HttpInteceptor doesn't put token on the header of the http request.

Mirzaev, Takhir 1 Reputation point
2022-03-01T12:22:43.927+00:00

Msal v2 httpInterceptor doesn't work properly

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,800 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 28,031 Reputation points Microsoft Employee
    2022-03-02T12:17:17.797+00:00

    Hi @Mirzaev, Takhir

    Thanks for reaching out.

    MSAL Angular provides an Interceptor that automatically acquires and handle tokens that use the Angular http client to known protected resources.

    In the Msal Interceptor make sure to configure the protected resources and the corresponding scopes in the protectedResourceMap correctly to get the token for required audience.

    Refer the below sample to setup MSAL Interceptor

    https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/v2-docs/msal-interceptor.md

    Could you please elaborate what scopes you are setting and the error you are getting while acquiring the token?

    Thanks,
    Shweta

    ---------------------------------------

    Please remember to "Accept Answer" if answer helped you.