【发布时间】:2017-10-09 13:19:33
【问题描述】:
我在使用 Microsoft Graph 时尝试对用户进行身份验证,并不断收到错误 Failed to acquire token silently. Call method AcquireToken。
任何想法如何解决这个问题?
try
{
AuthenticationResult result =
await authContext.AcquireTokenSilentAsync(SettingsHelper.GraphResourceId,
clientCredential,
userId);
return result.AccessToken;
}
// Unable to retrieve the access token silently.
catch (AdalException ex)
{
HttpContext.Current.Request.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties() { RedirectUri = "/" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
throw new Exception(Resource.Error_AuthChallengeNeeded + $" {ex.Message}");
}
【问题讨论】:
标签: asp.net model-view-controller azure-active-directory microsoft-graph-api