无法通过Azure AD同时获取多个资源的令牌

时间:2017-08-23 18:30:08

标签: asp.net-mvc azure-active-directory microsoft-graph

我有一个Web应用程序,我正在尝试使用下面提到的代码片段同时获取Power BI和Microsoft Graph API的令牌。

AuthenticationContext authContext = 
    new AuthenticationContext(Authority, new NaiveSessionCache(signedInUserID));

//Getting Power BI token
AuthenticationResult result = await authContext.AcquireTokenByAuthorizationCodeAsync(
   code,
   new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)),
   credential, 
   pbiResourceID);

//Getting Graph token
AuthenticationResult graphResult = await authContext.AcquireTokenByAuthorizationCodeAsync(
  code, 
  new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), 
  credential, 
  graphResourceId);

从Graph API获取令牌的请求失败,错误:

  

AADSTS50079:用户需要使用多重身份验证

0 个答案:

没有答案