使用 msal-browser 了解用户是否仍在登录的最佳方法
Best way to know if a user is still logged in using msal-browser
我之前在msal
1.x中使用了GetAccount
函数。
现在,我的理解是,即使用户已注销,msal-browser
也会 return 缓存 Account
。
acquireTokenSilent
也会 return 一个未过期的缓存令牌,即使用户不再登录也是如此。
那么了解用户是否仍在 B2C 中登录的最佳方法是什么?
此外,已注销的用户还能用刷新令牌交换访问令牌吗?
1.So what is the best way to know if a user is still logged in in B2C?
MSAL.js 不会跟踪当前登录的 account.So 我们只能知道用户是否已登录,但无法知道他们是否仍处于登录状态 in.Because想要将用户从应用程序中注销,仅清除应用程序的 cookie 或以其他方式结束与用户的会话是不够的。请参考this.
2.Additionally, can a logged-out user still exchange a refresh token for an access token?
只要刷新令牌没有过期,登出的用户可以获得访问令牌。
我之前在msal
1.x中使用了GetAccount
函数。
现在,我的理解是,即使用户已注销,msal-browser
也会 return 缓存 Account
。
acquireTokenSilent
也会 return 一个未过期的缓存令牌,即使用户不再登录也是如此。
那么了解用户是否仍在 B2C 中登录的最佳方法是什么?
此外,已注销的用户还能用刷新令牌交换访问令牌吗?
1.So what is the best way to know if a user is still logged in in B2C?
MSAL.js 不会跟踪当前登录的 account.So 我们只能知道用户是否已登录,但无法知道他们是否仍处于登录状态 in.Because想要将用户从应用程序中注销,仅清除应用程序的 cookie 或以其他方式结束与用户的会话是不够的。请参考this.
2.Additionally, can a logged-out user still exchange a refresh token for an access token?
只要刷新令牌没有过期,登出的用户可以获得访问令牌。