我有一些代码正在使用MSAL 1.1.0-alpha307,但是在1.1.0预览版中,它会抛出异常“client info is null”,它会在HTTP响应中返回。该应用程序在AAD V2端点中注册,它获取MS Graph数据。从下面的堆栈跟踪中,它看起来能够获取Graph的令牌但无法缓存它。
有人可以建议诊断/修复/解决方法吗?
这是代码:
var bootstrapContext = ClaimsPrincipal.Current.Identities.First().BootstrapContext as BootstrapContext;
UserAssertion userAssertion = new UserAssertion(bootstrapContext.Token);
ClientCredential clientCred = new ClientCredential(ConfigurationManager.AppSettings["ida:Password"]);
ConfidentialClientApplication cca =
new ConfidentialClientApplication(ConfigurationManager.AppSettings["ida:ClientID"],
"https://localhost:44355", clientCred, null, null);
string[] graphScopes = { "Files.Read.All" };
AuthenticationResult result = await cca.AcquireTokenOnBehalfOfAsync(graphScopes, userAssertion, "https://login.microsoftonline.com/common/oauth2/v2.0");
这是堆栈跟踪:
{"Message":"An error has occurred.","ExceptionMessage":"client info is null","ExceptionType":"Microsoft.Identity.Client.MsalClientException","StackTrace":" at Microsoft.Identity.Client.Internal.ClientInfo.CreateFromJson(String clientInfo)\r\n at Microsoft.Identity.Client.Internal.Requests.RequestBase.SaveTokenResponseToCache()\r\n at Microsoft.Identity.Client.Internal.Requests.RequestBase.PostTokenRequest()\r\n at Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__33.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Identity.Client.ConfidentialClientApplication.<AcquireTokenOnBehalfCommonAsync>d__16.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Identity.Client.ConfidentialClientApplication.<AcquireTokenOnBehalfOfAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at Office_Add_in_ASPNET_SSO_WebAPI.Controllers.ValuesController.<Get>d__0.MoveNext() in D:\\repos\\Office-Add-in-ASP.NET-SSO\\Complete\\Office-Add-in-ASPNET-SSO-WebAPI\\Controllers\\ValuesController.cs:line 46\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}
答案 0 :(得分:0)
这是Azure Active Directory V2.0端点中的一个错误。它是固定的。