如何在MSAL.js中使用LocalStorage [英] How To Use LocalStorage with MSAL.js
本文介绍了如何在MSAL.js中使用LocalStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 MSAL.js 中使用LocalStorage?
How do I use LocalStorage with MSAL.js?
According to this, there's a property, cacheLocation, I need to set to 'localStorage'.
以下内容仍在使用sessionStorage:
The following is still using sessionStorage:
var clientApplication = new Msal.UserAgentApplication(applicationConfig.clientID, applicationConfig.authority, function (errorDesc, token, error, tokenType) {
// Called after loginRedirect or acquireTokenPopup
});
clientApplication.cacheLocation = 'localStorage';
推荐答案
Looks like the documentation is slightly out of date, see this GitHub issue: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/58. To set the cache location in the latest releases of msal.js, use the following pattern:
var userAgentApplication = new Msal.UserAgentApplication(applicationConfig.clientID,
null, authCallback, { cacheLocation: 'localStorage' }); // to set it to localStorage
这篇关于如何在MSAL.js中使用LocalStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文