logoutRedirect() gives --> "Error - Attempted to clear all MSAL cache items and failed. Local cache unchanged."
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.22.0
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
2.1.1
Description
Everything seems to be working fine, but when you do msalService.logoutRedirect() you will get an error (in Chrome browser console + preserve logs): “Error - Attempted to clear all MSAL cache items and failed. Local cache unchanged.”.
After some research I managed to find out the there it at least a “not a function” exception in CryptoOps.ts when doing databaseStorage.deleteDatabase():
Error Message
- Error - Attempted to clear all MSAL cache items and failed. Local cache unchanged.
- databaseStorage.deleteDatabase is not a function
Msal Logs
No response
MSAL Configuration
auth: {
clientId: <myappid>,
authority: `https://login.microsoftonline.com/${<mytenantid>}`,
redirectUri: '<myredirecturl>',
postLogoutRedirectUri: '<mylogouturl>',
navigateToLoginRequestUrl: false
},
cache: {
cacheLocation: BrowserCacheLocation.LocalStorage,
storeAuthStateInCookie: false,
},
system: {
loggerOptions: {
logLevel: LogLevel.Error,
loggerCallback: (level, message) => {
console.log(level, message);
},
piiLoggingEnabled: false
}
}
Relevant Code Snippets
msalService.logoutRedirect();
Reproduction Steps
- Open Chrome developer tools
- Open console
- Toggle “preserve logs”
- msalService.LoginRedirect();
- msalService.logoutRedirect();
- See the console output for error.
Expected Behavior
- databaseStorage.deleteDatabase() should not cause “is not a function”
- logoutRedirect() should not cause an error message
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome
Regression
No response
Source
External (Customer)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
logout method not clearing credentials from cache #2123
Is there a way to invalidate the session on the server when a user logs out? What is otherwise the purpose of calling...
Read more >MSAL sign out does not appear to clear cache - Microsoft Learn
We have an android application integrated with azure authentication using MSAL and it's configured to be single tenant.
Read more >How to Clear the cache token in MSAL SPA? - Stack Overflow
I don't think that's MSAL that is caching there, it's Azure AD. You can specify a prompt query parameter to the request to...
Read more >Five Gotchas while using MSAL with Azure AD
Incorrect Scope specified, got error after login. Resolution. When we specify the scopes of our APIs, make sure we specify complete URI.
Read more >PublicClientApplication | microsoft-authentication-libraries-for-js
Returns all accounts that MSAL currently has data for. (the account object is created at the time of successful login) or empty array...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mettoware We were able to reproduce this and hope to have a PR up to fix this shortly - thanks for bringing this to our attention!
🎉This issue was addressed in #4617, which has now been successfully released as
@azure/msal-browser@v2.23.0
.🎉Handy links: