使用ADAL检测到multiple_matching_tokens_ [英] multiple_matching_tokens_detected with ADAL

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

问题描述

我有一项使用Azure访问令牌的服务,该令牌是使用ADAL检索的。我们有几百个客户,但是由于某些原因,当我们尝试为他们检索 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_的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆