microsoft-authentication-library-for-js: Observable fro msalBroadcastService doesn't send all InteractionStatus or Event
Core Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.18.0
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
2.0.4
Description
Since msal-angular 2.0.3, Observables from msalBroadcastService
doesn’t send all data:
inProgress$
: missing someInteractionStatus
such asnone
. I receive onlystartup
msalSubject$
: missing someEventMessage
such ashandleRedirectStart
. I receive some other likehandleRedirectEnd
Error Message
No response
Msal Logs
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-angular@2.0.4 : Verbose - MsalRedirectComponent activated' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - handleRedirectPromise called' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - getAllAccounts called' msalInstance.factory.ts:8
2 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:handleRedirectStart' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - handleRedirectPromise has been called for the first time, storing the promise' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : [5fc57d40-0f7c-41a6-bf5c-b1cca863e9a4] : msal.js.browser@2.18.0 : Verbose - initializeServerTelemetryManager called' msalInstance.factory.ts:8
2 '[Wed, 20 Oct 2021 16:11:21 GMT] : [5fc57d40-0f7c-41a6-bf5c-b1cca863e9a4] : msal.js.browser@2.18.0 : Info - handleRedirectPromise called but there is no interaction in progress, returning null.' core.js:28039
Angular is running in development mode. Call enableProdMode() to enable production mode. msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - Event callback registered with id: fd4aeb5a-9e1b-45ea-b685-3f9c66bbfbf6' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - getAllAccounts called' auth.service.ts:31
MSAL Interaction Status: startup msalInstance.factory.ts:8
2 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Info - Emitting event: msal:handleRedirectEnd' msalInstance.factory.ts:8
3 '[Wed, 20 Oct 2021 16:11:21 GMT] : @azure/msal-browser@2.18.0 : Verbose - Emitting event to callback fd4aeb5a-9e1b-45ea-b685-3f9c66bbfbf6: msal:handleRedirectEnd'
auth.service.ts:45
MSAL Event Type: msal:handleRedirectEnd index.js:52
[WDS] Live Reloading enabled.
MSAL Configuration
export function MSALInstanceFactory(): IPublicClientApplication {
return new PublicClientApplication({
auth: {
clientId: environment.aad.clientId,
authority: 'https://login.microsoftonline.com/' + environment.aad.tenantId,
redirectUri: environment.aad.redirectUri,
postLogoutRedirectUri: '/',
navigateToLoginRequestUrl: true
},
cache: {
cacheLocation: 'sessionStorage',
storeAuthStateInCookie: false
},
system: {
loggerOptions: {
loggerCallback,
logLevel: LogLevel.Verbose,
piiLoggingEnabled: false
}
}
});
}
Relevant Code Snippets
// inProgress Observble
this.msalBroadcastService.inProgress$.subscribe({
next: (status: InteractionStatus) => {
if (environment.debug.msal) {
console.log(`MSAL Interaction Status: ${status}`);
}
}
});
// msalSubject observable
this.msalBroadcastService.msalSubject$.subscribe({
next: (event: EventMessage) => {
if (environment.debug.msal) {
console.log(`MSAL Event Type: ${event.eventType}`);
}
}
});
Reproduction Steps
- Clone https://github.com/0xdbe-example/angular-msal-azure-ad
- Configure Azure AD and MSAL (in environment file)
- Run with
ng serve
(needs mkcert for HTTPS) - Open your browser, authentication should works
- Update MSAL and restart
- Open your browser, authentication doesn’t work anymore.
Expected Behavior
inProgress$
: must send allInteractionStatus
includingnone
msalSubject$
: must send allEventMessage
includinghandleRedirectStart
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome
Regression
@azure/msal-angular 2.0.1 with @azure/msal-browser 2.16.1
Source
External (Customer)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
Any updates?
Still reproducing with Angular v14 and
"@azure/msal-angular": "^2.5.5"
,"@azure/msal-browser": "^2.35.0"
. If I don’t injectprivate msalBroadcastService: MsalBroadcastService
in myauth.service.ts
, I’m unable to login/logout.I used APP_INITIALIZER for the redirect handling. It works only when I include MsalBroadcastService as a dependency:
Otherwise I get
startup
when the Interceptor tries to refresh the token.This issue still exists. I’m getting only ‘Startup’ interaction status and couldn’t get status as ‘None’. Any permanent fix for this issue would be really helpful.