MSAL 2.0 asking for login everytime making graph api call

Omkar 6 Reputation points
2021-12-14T11:21:48.39+00:00

Hi all,

  • Im making Graph Search API call for Mail.Read scope.
  • I have integrated MSAL 2.0 for Angular 10
  • App is working as expected on localhost. Login -> Make API -> get response.
  • But after deploying on cloud its calling loginPopup for every Graph API call. Login -> Make API -> loginPopup -> get response. Please refer to MSAL logs below

Environment details

  • Chrome
  • Angular 10
  • "@azure/msal-angular": "^2.0.6"
  • "@azure/msal-browser": "^2.20.0"

Some observed logs

While signing in

Info - in acquireToken call
Info - Emitting event: msal:acquireTokenSuccess
Verbose - setActiveAccount: Active account set

While making api calls

Verbose - MSAL Interceptor activated
Verbose - Interceptor - getting scopes for endpoint
Verbose - Interceptor - no active account, fallback to first account
Error - Interceptor - acquireTokenSilent rejected with error. Invoking interaction to resolve.
Verbose - Interceptor - error acquiring token silently, acquiring by popup

SOS. Thanks in advance!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,326 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,201 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Frank F 1 Reputation point
    2021-12-15T06:09:36.303+00:00

    I am having the same error. This started to happen recently.

    I am using Angular 12
    msal@2.0.4 and it is also happening when using msal@2.0.6
    MS Edge and Chrome

    Thanks!
    @azure/msal-angular@2.0.4 : Error - Interceptor - acquireTokenSilent rejected with error. Invoking interaction to resolve.
    core.js:6479

       ERROR Error: Uncaught (in promise): BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API.  For more visit: aka.ms/msaljs/browser-errors.
    

    BrowserAuthError: interaction_in_progress: Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. For more visit: aka.ms/msaljs/browser-errors.
    at BrowserAuthError.AuthError [as constructor] (BaseClient.js:56)
    at new BrowserAuthError (GuidGenerator.js:50)
    at Function.BrowserAuthError.createInteractionInProgressError (PkceGenerator.js:8)
    at RedirectClient.StandardInteractionClient.preflightInteractiveRequest (RedirectClient.js:278)
    at RedirectClient.<anonymous> (EventType.js:17)
    at step (_tslib.js:54)
    at Object.next (_tslib.js:35)
    at _tslib.js:28
    at new ZoneAwarePromise (zone.js:1387)
    at awaiter (_tslib.js:24)
    at resolvePromise (zone.js:1213)
    at zone.js:1120
    at zone.js:1136
    at ZoneDelegate.invoke (zone.js:372)
    at Object.onInvoke (core.js:28673)
    at ZoneDelegate.invoke (zone.js:371)
    at Zone.run (zone.js:134)
    at zone.js:1276
    at ZoneDelegate.invokeTask (zone.js:406)
    at Object.onInvokeTask (core.js:28660)
    defaultErrorLogger @ core.js:6479
    handleError @ core.js:6527
    next @ core.js:29284
    __tryOrUnsub @ BehaviorSubject.js:31
    next @ index.js:1965
    _next @ index.js:1916
    next @ index.js:1894
    next @ index.js:1685
    emit @ core.js:25936
    (anonymous) @ core.js:28699
    invoke @ zone.js:372
    run @ zone.js:134
    runOutsideAngular @ core.js:28572
    onHandleError @ core.js:28699
    handleError @ zone.js:376
    runGuarded @ zone.js:147
    api.microtaskDrainDone @ zone.js:1074
    drainMicroTaskQueue @ zone.js:589
    Promise.then (async)
    scheduleMicroTask @ zone.js:565
    scheduleTask @ zone.js:396
    scheduleTask @ zone.js:221
    scheduleMicroTask @ zone.js:241
    scheduleResolveOrReject @ zone.js:1266
    then @ zone.js:1410
    bootstrapModule @ core.js:29326
    4431 @ environment.qa.ts:21
    __webpack_require
    @ bootstrap:19
    webpack_exec @ main.ts:4
    (anonymous) @ main.ts:5
    webpack_require.O @ chunk loaded:23
    (anonymous) @ main.ts:7
    webpackJsonpCallback @ jsonp chunk loading:33
    (anonymous) @ main.js:1


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.