使用 ADAL 检测到的 multiple_matching_tokens_detected

multiple_matching_tokens_detected with ADAL(使用 ADAL 检测到的 multiple_matching_tokens_detected)
本文介绍了使用 ADAL 检测到的 multiple_matching_tokens_detected的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一项服务使用我们使用 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) :

  1. 关闭所有 Visual Studio 实例(在你的情况下 - 我想关闭所有客户端应用程序).
  2. 删除 %LOCALAPPDATA%.IdentityService.
  3. 享受吧.

像魔术一样为我工作

这篇关于使用 ADAL 检测到的 multiple_matching_tokens_detected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)