BrowserAuthError: uninitialized_public_client_application #7215
Labels
bug-unconfirmed
A reported bug that needs to be investigated and confirmed
msal-browser
Related to msal-browser package
msal-react
Related to @azure/msal-react
public-client
Issues regarding PublicClientApplications
question
Customer is asking for a clarification, use case or information.
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
3.17.0
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
2.0.19
Public or Confidential Client?
Public
Description
I'm trying to make a request to the api. And i expect to get back valid data from the api.
I have been doing requests with fetch, witch have been working fine, but when im moving over to axios it throw me errors.
I'm moving over to axios because when using fetch i encountered issues with token expiering, I had to create a function to make sure that tokens are updated and fresh, but this is running every time a user is updating the page, witch is fine when its only testing, but when over 100 people will use the application after testing this will cause the application to be slow.
Also, the maintainability of the application is a mess, by using axios I can maintain the application better.
Here is the "hack" i have made to check and ensure token is valid:
Error Message
ERROR
uninitialized_public_client_application: You must call and await the initialize function before attempting to call any other MSAL API. For more visit: aka.ms/msaljs/browser-errors
BrowserAuthError: uninitialized_public_client_application: You must call and await the initialize function before attempting to call any other MSAL API. For more visit: aka.ms/msaljs/browser-errors
at createBrowserAuthError (http://localhost:3000/static/js/bundle.js:91323:10)
at blockAPICallsBeforeInitialize (http://localhost:3000/static/js/bundle.js:96140:94)
at preflightCheck (http://localhost:3000/static/js/bundle.js:96155:3)
at preflightCheck (http://localhost:3000/static/js/bundle.js:89212:76)
at StandardController.acquireTokenPopup (http://localhost:3000/static/js/bundle.js:89519:7)
at PublicClientApplication.acquireTokenPopup (http://localhost:3000/static/js/bundle.js:85634:28)
at http://localhost:3000/main.b10741c45db6e546178e.hot-update.js:45:35
at Axios.request (http://localhost:3000/static/js/bundle.js:107133:41)
at async fetchCaseByCaseId (http://localhost:3000/main.e5cb28d44cffb697d41e.hot-update.js:27:7)
at async readData (http://localhost:3000/main.f1dc14bae878f949a492.hot-update.js:32:20)
MSAL Logs
[Wed, 24 Jul 2024 06:19:37 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - BrowserCrypto: modern crypto interface available
index.js:15 [Wed, 24 Jul 2024 06:19:37 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - BrowserCrypto: modern crypto interface available index.js:24
[Wed, 24 Jul 2024 06:19:37 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Event callback registered with id: 0190e365-3041-7af7-8dcf-ef01bb68396c BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Event callback registered with id: 0190e365-30c0-7988-963b-30b75cc9224d BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - MsalProvider - Registered event callback with id: 0190e365-30c0-7988-963b-30b75cc9224d BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:initializeStart BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c0-7988-963b-30b75cc9224d: msal:initializeStart BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - MsalProvider - Removing event callback 0190e365-30c0-7988-963b-30b75cc9224d BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Event callback 0190e365-30c0-7988-963b-30b75cc9224d removed. BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Event callback registered with id: 0190e365-30c3-7d67-b025-8cc4ec8bbe91 BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - MsalProvider - Registered event callback with id: 0190e365-30c3-7d67-b025-8cc4ec8bbe91 BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:initializeStart BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c3-7d67-b025-8cc4ec8bbe91: msal:initializeStart 2BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called 2BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called 2BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Extension with id: ppnbnpeolgkicgegkbkbjmhlideopiji not installed 2axiosInstance.js:11
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called axiosInstance.js:33
[Wed, 24 Jul 2024 06:19:38 GMT] : [0190e365-30d1-774a-881d-3c34ea3d39c2] : @azure/msal-browser@3.20.0 : Verbose - acquireTokenPopup called axiosInstance.js:33
[Wed, 24 Jul 2024 06:19:38 GMT] : [0190e365-30d2-75e1-afb9-774871e22929] : @azure/msal-browser@3.20.0 : Verbose - acquireTokenPopup called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - No extension installed BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - BrowserAuthError: native_extension_not_installed: Native extension is not installed. If you think this is a mistake call the initialize function. BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:initializeEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c3-7d67-b025-8cc4ec8bbe91: msal:initializeEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - handleRedirectPromise called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:handleRedirectStart BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c3-7d67-b025-8cc4ec8bbe91: msal:handleRedirectStart BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [0190e365-30d4-7f1c-8b5b-a86c5c0a4b67] : msal.js.browser@3.20.0 : Verbose - initializeServerTelemetryManager called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - handleRedirectPromise has been called for the first time, storing the promise BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:handleRedirectEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c3-7d67-b025-8cc4ec8bbe91: msal:handleRedirectEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - No extension installed BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - BrowserAuthError: native_extension_not_installed: Native extension is not installed. If you think this is a mistake call the initialize function. BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-3041-7af7-8dcf-ef01bb68396c: msal:initializeEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - Emitting event to callback 0190e365-30c3-7d67-b025-8cc4ec8bbe91: msal:initializeEnd BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - handleRedirectPromise called BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - handleRedirectPromise has been called previously, returning the result from the first call 6BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called 6BaseOperatingContext.ts:44
[Wed, 24 Jul 2024 06:19:38 GMT] : [] : @azure/msal-browser@3.20.0 : Verbose - getAllAccounts called
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
Expected Behavior
I expect the app to ensure tokens is valid to avoid that user have to log back in when token is expired, if the token is valid and the user do a search on a casenumber (later also licenceplate number) the application will give back data.
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Chrome, Edge
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: