在静默流中启用多用户访问,以便能够并行使用具有不同帐户的服务器
Enable multi user access in silent-flow to be able to use server with different accounts parallel
silent-flow 示例完美运行。我可以登录和注销。
但是当我尝试使用 2 个不同的帐户登录 2 个不同的浏览器时。然后旧浏览器将在页面重新加载时使用上次登录的帐户登录。
我知道它总是从缓存中获取最后一个 homeAccountId
,正如代码所说:
const account = await msalTokenCache.getAccountByHomeId(app.locals.homeAccountId);
我现在的问题是,如何启用多用户?如何改写app.locals
?有例子吗?
否则是否需要为此创建一些自定义代码?
我想你可以试试this sample。
根据this doc,getAccountByHomeId()
only supports working single account scenario, so here we need a new sample which uses getAllAccounts()
.
silent-flow 示例完美运行。我可以登录和注销。
但是当我尝试使用 2 个不同的帐户登录 2 个不同的浏览器时。然后旧浏览器将在页面重新加载时使用上次登录的帐户登录。
我知道它总是从缓存中获取最后一个 homeAccountId
,正如代码所说:
const account = await msalTokenCache.getAccountByHomeId(app.locals.homeAccountId);
我现在的问题是,如何启用多用户?如何改写app.locals
?有例子吗?
否则是否需要为此创建一些自定义代码?
我想你可以试试this sample。
根据this doc,getAccountByHomeId()
only supports working single account scenario, so here we need a new sample which uses getAllAccounts()
.