【发布时间】:2019-07-07 13:31:56
【问题描述】:
我正在尝试在没有当前用户的情况下获取应用程序的令牌。我收到一条错误消息:
e.Message = "缓存中未找到令牌,无法静默获取令牌。调用方法 AcquireToken"
下面是我用来获取令牌的代码。
ClientCredential clientcred = new ClientCredential(clientId, appKey);
AuthenticationContext authenticationContext = new AuthenticationContext(aadInstance + tenantId);
AuthenticationResult authenticationResult = await authenticationContext.AcquireTokenSilentAsync(graphResourceID, clientId);
return authenticationResult.AccessToken;
我的版本是:
有人可以帮忙解决这个问题吗?我已经尝试了好几天了...我可以在为当前用户获取令牌时找到一个令牌,但是当我有后台进程(例如从应用程序发送电子邮件而没有经过身份验证)时用户我无法获得令牌。
我的 Microsoft Graph 应用注册下的安全设置“应用程序 - 从任何用户发送电子邮件”但我不认为它会走那么远。 Windows Azure AD 上的安全性已委托 - 登录并阅读用户配置文件。
谢谢
【问题讨论】:
-
抱歉,直到发布该版本未粘贴后才意识到:Microsoft.IdentityModel.Clients.ActiveDirectory 是 4.5.1 版
标签: c# .net adal azure-ad-graph-api