[英]How to use forceRefresh: true in msal-angular config?
Tried using MSAL Angular.尝试使用 MSAL Angular。 Wanted to skip cache which store access token at client side.
想要跳过在客户端存储访问令牌的缓存。 Skip cache option is available in msal.
msal 中提供了跳过缓存选项。 Ref
参考
Library used msal-angular @azure/msal-angular@1.xx
库使用msal-angular
@azure/msal-angular@1.xx
Config pass inside MsalModule.forRoot({})
not accepting forceRefresh
MsalModule.forRoot({})
中的配置传递不接受forceRefresh
What is the best way to skipCache
ie to not store access token on client and use forceRefresh
in config?跳过缓存的最佳方法是什么,即不在客户端存储访问令牌
forceRefresh
skipCache
You should execute acquireTokenSilent
with AuthenticationParameters - forceRefresh as true
.您应该在 AuthenticationParameters-forceRefresh 为
true
的情况下执行acquireTokenSilent
。 According to the docs https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular#login-and-acquiretoken-apis根据文档https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular#login-and-acquiretoken-apis
And also:并且:
This should not be used by default, because of the performance impact on your application.
默认情况下不应使用此选项,因为这会影响您的应用程序的性能。 Relying on the cache will give your users a better experience, and skipping it should only be used in scenarios where you know the current cached data does not have up to date information.
依赖缓存会给你的用户带来更好的体验,跳过它应该只在你知道当前缓存的数据没有最新信息的情况下使用。 Example: Admin tool to add roles to a user that needs to get a new token with updates roles.
示例:用于向需要获取具有更新角色的新令牌的用户添加角色的管理工具。
You can look around that method code on Github, if you need more information: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-core/src/UserAgentApplication.ts#L705如果需要更多信息,可以在 Github 上查看该方法代码: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-core/src/UserAgentApplication。 ts#L705
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.