简体   繁体   English

如何在 msal-angular 配置中使用 forceRefresh: true?

[英]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.

相关问题 如何侦听 MSAL-Angular 令牌重新身份验证请求? - How do I listen for MSAL-Angular token reauthentiation requests? 如何使用@azure/msal-angular 获取用户的 AAD 会员资格 - How to get user's AAD memberships with @azure/msal-angular 您如何使用 MSAL-ANGULAR 读取角色/权限 - How do you read Roles/Permissions using MSAL-ANGULAR Azure Ad B2C:如何使用 msal-angular 传递在重定向中仍然可用的参数 url - Azure Ad B2C: How to use use msal-angular to pass parameter which still available in redirect url 登录后如何获取用户名?我正在尝试使用 MSAL (@azure/msal-angular) 进行 Azure 登录 - How to get username after logged in?.I am trying with MSAL (@azure/msal-angular) for Azure Signin @ azure / msal-angular的元数据版本不匹配 - MetaData version mismatch for @azure/msal-angular MSAL-angular 要求额外的权限 - MSAL-angular asking for additional premissions 如何配置 msal-angular 拦截器以将访问令牌 (v2) 发送到自己的域 (self) - How to configure msal-angular interceptor to send an access token (v2) to own domain (self) @azure/msal-angular package 会自动刷新令牌吗? - Does the @azure/msal-angular package automatically refresh token? MSAL-Angular 是否有任何事件或回调可用于注册完成? - MSAL-Angular is there any event or callback available for signup completed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM