我有一项服务使用我们使用 ADAL 检索的 Azure 访问令牌.我们有数百个客户,但由于某种原因,当我们尝试为他们检索 AuthenticationResult 时,其中有两个偶尔会生成此错误:
I have a service that uses Azure access tokens that we retrieve using ADAL. We have several hundred customers, but for some reason there are two of them that sporadically generate this error when we try to retrieve an AuthenticationResult for them:
multiple_matching_tokens_detected:缓存包含多个令牌满足要求.再次调用 AcquireToken 提供更多信息要求(例如 UserId).
multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements (e.g. UserId).
我不知道为什么数百人中只有这两个人有这个问题,而且在网上找不到太多关于它的信息.我们获取令牌的代码如下所示(简化):
I have no idea why only these two folks out of hundreds have this issue and really can't find much about it on the net. Our code to acquire a token looks like this (simplified):
AuthenticationContext authContext = new AuthenticationContext(authority, new MyCustomTokenCache());
ClientCredential credential = new ClientCredential(myClientId, myPassword);
authContext.AcquireTokenSilent(resourceUri, credential, UserIdentifier.AnyUser);
为什么会出现此错误?解决此错误的建议"解决方案是什么?我一直倾向于尝试通过获取这样的令牌来修复它,但我真的很想知道错误的真正含义:
Why does this error occur and what is the "suggested" solution to resolve it? I have been leaning towards trying to fix it by acquiring a token like so but really would like to know what the error really is all about:
authContext.AcquireTokenSilent(mr.ResourceUri, credential, new UserIdentifier("usersUPN@foo.com", UserIdentifierType.UniqueId));
如果这仍然相关,我有类似的问题 multiple_matching_tokens_detected 错误,我发现了这个:
If this is still relevant, I had similar problem with multiple_matching_tokens_detected error and I found this:
https://developercommunity.visualstudio.com/content/problem/17315/cant-add-new-account-with-vsts-online-failed-to-re.html
正如 Alex 在回答中提到的那样(您需要在客户端机器上执行此操作):
As Alex at the answer there mentioned (You need to do this on the client machine) :
像魔术一样为我工作
这篇关于使用 ADAL 检测到的 multiple_matching_tokens_detected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
ASP.NET Core 使用 Azure Active Directory 进行身份验证并ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 进行身
ASP.NET Core 2.0 Web API Azure Ad v2 令牌授权不起作用ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授权不起作用)
如何获取守护进程或服务器到 C# ASP.NET Web API 的How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何获取守护进程或服务器到 C# ASP.N
异步调用时 Azure KeyVault Active Directory AcquireTokenAAzure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(异步调用时 Azure KeyVault Active Directory AcquireTokenAsync 超
使用电子邮件地址和应用程序密码从 oauth2/tokenGetting access token using email address and app password from oauth2/token(使用电子邮件地址和应用程序密码从 oauth2/token 获取访问令
新的 Azure AD 应用程序在通过管理门户更新之前无New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 应用程序在通过管理门户更新之前无法运行