AzureAD / microsoft-authentication-library-for-js

Microsoft Authentication Library (MSAL) for JS
http://aka.ms/aadv2
MIT License
3.64k stars 2.65k forks source link

EmptyError: no elements in sequence #6806

Closed skatterwe closed 6 months ago

skatterwe commented 9 months ago

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.0.2

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.2

Public or Confidential Client?

Public

Description

In our Angular application we are using the MsalGuard and MsalInterceptor to authenticate with AzureAD.

Whenever the token is expired or a Bad Request (400) is returned from the Microsoft /token call, we see the error: Uncaught (in promise): EmptyError: no elements in sequence just after the loginStart with interaction is initiated in our application logs.

I've attached the verbose msal log from the first application call up until when the error occurs.

I've also attached our configuration code for the msal guard and the interceptor.

The error doesn't prevent the loginStart to work. It redirects and then goes back and logins the user correctly. But the error is occurring so frequently that I wanted to create this ticket here.

Error Message

Uncaught (in promise): EmptyError: no elements in sequence Error at _super (vendor.js:64541:22) at new EmptyErrorImpl (vendor.js:64333:3) at vendor.js:62369:395 at vendor.js:63298:66 at OperatorSubscriber._complete (vendor.js:61930:9) at OperatorSubscriber.complete (vendor.js:60888:12) at OperatorSubscriber._complete (vendor.js:60910:24) at OperatorSubscriber.complete (vendor.js:60888:12) at OperatorSubscriber._complete (vendor.js:60910:24) at OperatorSubscriber.complete (vendor.js:60888:12) at resolvePromise (polyfills.js:9071:19) at resolvePromise (polyfills.js:9024:9) at polyfills.js:9132:9 at _ZoneDelegate.invokeTask (polyfills.js:8297:171) at vendor.js:97460:49 at AsyncStackTaggingZoneSpec.onInvokeTask (vendor.js:97460:30) at _ZoneDelegate.invokeTask (polyfills.js:8297:54) at Object.onInvokeTask (vendor.js:97774:25) at _ZoneDelegate.invokeTask (polyfills.js:8297:54) at Zone.runTask (polyfills.js:8101:37)

Msal Logs

Navigated to http://localhost:4200/ VM261:6314 [webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCrypto: modern crypto interface available VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:initializeStart VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:initializeEnd VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - Event callback registered with id: 330334b4-5dec-4fdc-adf4-f191d4ab3437 VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:handleRedirectStart VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback 330334b4-5dec-4fdc-adf4-f191d4ab3437: msal:handleRedirectStart VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:handleRedirectStart results in setting inProgress from startup to handleRedirect VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise has been called for the first time, storing the promise VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [735298c1-79dd-4d5a-aec2-133856b0508a] : msal.js.browser@3.0.2 : Verbose - initializeServerTelemetryManager called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [735298c1-79dd-4d5a-aec2-133856b0508a] : msal.js.browser@3.0.2 : Info - handleRedirectPromise called but there is no interaction in progress, returning null. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM272:4676 Angular is running in development mode. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:handleRedirectEnd VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback 330334b4-5dec-4fdc-adf4-f191d4ab3437: msal:handleRedirectEnd VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:handleRedirectEnd results in setting inProgress from handleRedirect to none VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Guard - canActivate VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Guard activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - initialize has already been called, exiting early. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - initialize has already been called, exiting early. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise has been called previously, returning the result from the first call VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Guard - no accounts retrieved, log in required to activate VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Guard - logging in by redirect VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Guard - getting destination url VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : @azure/msal-browser@3.0.2 : Verbose - loginRedirect called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : @azure/msal-browser@3.0.2 : Verbose - acquireTokenRedirect called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - preflightBrowserEnvironmentCheck started VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - preflightInteractiveRequest called, validating app environment VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:loginStart VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback 330334b4-5dec-4fdc-adf4-f191d4ab3437: msal:loginStart VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:loginStart results in setting inProgress from none to login VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - initializeAuthorizationRequest called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getRedirectUri called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Initializing BaseAuthRequest VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - initializeServerTelemetryManager called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - initializeAuthorizationRequest called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getClientConfiguration called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getDiscoveredAuthority called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Creating discovered authority with configured authority VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to get cloud discovery metadata from authority configuration VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork() VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to get endpoint metadata from authority configuration VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cached endpoint metadata... Attempting to get endpoint metadata from the network. VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from https://login.microsoftonline.com//v2.0/.well-known/openid-configuration VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Endpoint metadata was successfully returned from getEndpointMetadataFromNetwork() VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Auth code client created VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - RedirectHandler.initiateAuthRequest called VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page VM272:4676 [Mon, 08 Jan 2024 14:22:25 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - RedirectHandler.initiateAuthRequest: Navigating window to navigate url env.local.js:6314 [webpack-dev-server] Server started: Hot Module Replacement disabled, Live Reloading enabled, Progress disabled, Overlay enabled. Navigated to https://login.microsoftonline.com//oauth2/v2.0/authorize?client_id=CLIENT_ID&scope=SCOPE&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fredirect&client-request-id=f7b346a0-b8d7-4025-bd2b-44656672dbc0&response_mode=fragment&response_type=code&x-client-SKU=msal.js.browser&x-client-VER=3.0.2&client_info=1&code_challenge=CODE_CHALLENDE&code_challenge_method=S256&nonce=NONCE&state=STATE Navigated to https://device.login.microsoftonline.com/ Navigated to http://localhost:4200/redirect VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCrypto: modern crypto interface available VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:initializeStart VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:initializeEnd VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - Event callback registered with id: c73ae328-2b62-46bd-bb5f-03140e2c9b8b VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:handleRedirectStart VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback c73ae328-2b62-46bd-bb5f-03140e2c9b8b: msal:handleRedirectStart VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:handleRedirectStart results in setting inProgress from startup to handleRedirect VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise has been called for the first time, storing the promise VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - initializeServerTelemetryManager called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getRedirectResponseHash called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Hash contains known properties, returning response hash VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - validateAndExtractStateFromHash called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Returning state from hash VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - State extracted from hash VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - NavigateToLoginRequestUrl set to false, handling hash VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - handleHash called, retrieved cached request VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getClientConfiguration called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - getDiscoveredAuthority called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Creating discovered authority with configured authority VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to get cloud discovery metadata from authority configuration VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM29:4676 Angular is running in development mode. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork() VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Attempting to get endpoint metadata from authority configuration VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Did not find cached endpoint metadata... Attempting to get endpoint metadata from the network. VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from https://login.microsoftonline.com/cd99fef8-1cd3-4a2a-9bdf-15531181d65e/v2.0/.well-known/openid-configuration VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Endpoint metadata was successfully returned from getEndpointMetadataFromNetwork() VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - Auth code client created VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : msal.js.browser@3.0.2 : Verbose - RedirectHandler.handleCodeResponse called VM29:4676 [Mon, 08 Jan 2024 14:22:27 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : @azure/msal-common@14.0.2 : Info - in acquireToken call in auth-code client VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [f7b346a0-b8d7-4025-bd2b-44656672dbc0] : @azure/msal-common@14.0.2 : Verbose - No client info in response VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:acquireTokenSuccess VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback c73ae328-2b62-46bd-bb5f-03140e2c9b8b: msal:acquireTokenSuccess VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectResponse returned result, acquire token success VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:handleRedirectEnd VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback c73ae328-2b62-46bd-bb5f-03140e2c9b8b: msal:handleRedirectEnd VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:handleRedirectEnd results in setting inProgress from handleRedirect to none VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - Guard - canActivate VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Guard activated VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Info - initialize has already been called, exiting early. VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - MSAL Interceptor activated VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - getting scopes for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - no active account, fallback to first account VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Info - Interceptor - 1 scopes found for endpoint VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - preflightBrowserEnvironmentCheck started VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [2c2ccaaf-e4f5-4652-87ad-d0f813b91100] : @azure/msal-browser@3.0.2 : Verbose - acquireTokenSilent called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Info - initialize has already been called, exiting early. VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Error - Interceptor - acquireTokenSilent rejected with error. Invoking interaction to resolve. VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - Interceptor - error acquiring token silently, acquiring by redirect VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [5619dddc-ac02-4a00-a865-0b8d1a62173d] : @azure/msal-browser@3.0.2 : Verbose - acquireTokenRedirect called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - preflightBrowserEnvironmentCheck started VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - preflightInteractiveRequest called, validating app environment VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Info - Emitting event: msal:loginStart VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - Emitting event to callback c73ae328-2b62-46bd-bb5f-03140e2c9b8b: msal:loginStart VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-angular@3.0.2 : Verbose - BroadcastService - msal:loginStart results in setting inProgress from none to login VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - initializeAuthorizationRequest called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - getRedirectUri called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - Initializing BaseAuthRequest VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - getAllAccounts called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - BrowserCacheManager.getAccountKeys - No account keys found VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : @azure/msal-browser@3.0.2 : Verbose - handleRedirectPromise has been called previously, returning the result from the first call VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - initializeServerTelemetryManager called VM29:4676 [Mon, 08 Jan 2024 14:22:28 GMT] : [1b9e546a-081b-469b-b50f-61684654a829] : msal.js.browser@3.0.2 : Verbose - initializeAuthorizationRequest called

MSAL Configuration

{
    auth: {
      clientId: 'CLIENT_ID',
      authority: 'https://login.microsoftonline.com/TENAND_ID/',
      navigateToLoginRequestUrl: false,
      redirectUri: `${window.location.origin}/redirect`,
      postLogoutRedirectUri: `${window.location.origin}/login`,
    },
    cache: {
      cacheLocation: BrowserCacheLocation.LocalStorage,
      storeAuthStateInCookie: window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigator.userAgent.indexOf('Trident/') > -1, // set to true for IE 11
    },
    system: {
      loggerOptions: {
        loggerCallback: loggerCallback(),
        logLevel: LogLevel.Verbose,
        piiLoggingEnabled: false,
      },
    },

}

Relevant Code Snippets

const msalProtectedEndpointConfig = [
      {
        scopes: [SCOPE],
        uri: 'BACKEND_URL/authorization/*/token',
      },
    ],
const msalGuardConfig = {
      scopes: [SCOPE],
    },

export const getMsalInterceptorConfig = (
  msalProtectedEndpointConfig?: MsalProtectedEndpoint[]
): MsalInterceptorConfiguration => {
  const protectedResourceMap = new Map<string, Array<string>>();
  protectedResourceMap.set('https://graph.microsoft.com/v1.0/me', ['user.read']);

  if (msalProtectedEndpointConfig) {
    msalProtectedEndpointConfig.forEach((api) => {
      protectedResourceMap.set(api.uri, api.scopes);
    });
  }

  return {
    interactionType: InteractionType.Redirect,
    protectedResourceMap,
  };
};

export const getMsalGuardConfig = (msalGuardConfig?: { scopes: string[] }): MsalGuardConfiguration => {
  if (!config) {
    return {
      interactionType: InteractionType.Redirect,
    };
  }
  return {
    interactionType: InteractionType.Redirect,
    authRequest: {
      scopes: msalGuardConfig.scopes,
    },
  };
};

Reproduction Steps

  1. let token call return 400
  2. error is printed into the console

Expected Behavior

Login procedure does not throw uncaught errors in console

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

Chrome, Firefox, Edge

Regression

No response

Source

External (Customer)

poplevente commented 8 months ago

i'm having the same issue. any workaround?

skatterwe commented 7 months ago

i couldn't find one yet. currently we are ignoring the error so it's not logged any longer but that's not really the solution :)

jo-arroyo commented 6 months ago

@erbsenkoenig Are you able to provide your routes?

microsoft-github-policy-service[bot] commented 6 months ago

@erbsenkoenig This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.