multiple_matching_tokens_detected with ADAL(使用 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) :
- 关闭所有 Visual Studio 实例(在你的情况下 - 我想关闭所有客户端应用程序).
- 删除 %LOCALAPPDATA%.IdentityService.
- 享受吧.
像魔术一样为我工作
这篇关于使用 ADAL 检测到的 multiple_matching_tokens_detected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 ADAL 检测到的 multiple_matching_tokens_detected
基础教程推荐
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
