2017-05-17 54 views
2

我有一些代碼正在MSAL 1.1.0-alpha307上工作,但在1.1.0-預覽中它引發異常「客戶端信息爲空」,其中在HTTP響應中返回。該應用程序在AAD V2端點註冊並獲取MS Graph數據。從下面的堆棧跟蹤中,它看起來像能夠獲得Graph的令牌但不能緩存它。獲取「客戶端信息爲空」與MSAL 1.1.0-預覽

任何人都可以提出一個診斷/修復/解決方法嗎?

這是代碼:

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

同樣的問題在這裏,工作在開始,但稍後刷新令牌出現此異常。當你在5月17日問這個問題時,你找到了一個解決方法。 – rfcdejong

+0

這應該是固定的。我已經向開發者進行了調查。我會回報我發現的。 –

+0

我們的開發人員要求您安裝http://www.telerik.com/fiddler工具。從這種情況發生時捕獲請求/響應。您無法將其添加到評論中,因此請開始一個新問題並在其中包含提琴手數據。 –

回答

0

這竟然是在Azure中的Active Directory V2.0端點的錯誤。它是固定的。