我在尝试实施example outlined here时遇到了身份验证问题。
我的Azure应用设置已按照示例中的说明进行了修改,但我在某处遗漏了某些内容。
我的asp.net应用程序对用户服务器端进行身份验证(没有问题),但是如果可能的话,我想使用身份验证的结果作为人员选择器身份验证的基础(上面列出的示例尝试在页面onload
事件期间进行身份验证。
window.onload = function () {
var implicitGrantLogin = createLoginProvider();
createAppChrome(implicitGrantLogin);
var authContext = implicitGrantLogin.getAuthContext();
showPeoplePicker(authContext);
};
function createLoginProvider() {
var config = {
clientId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", //my app clientID masked
redirectUri: 'https://localhost:44343/Account/signin-oidc',
postLogoutRedirectUri: window.location,
cacheLocation: 'localStorage' // enable this for IE, as sessionStorage does not work for localhost.
};
var loginProvider = new Office.Controls.ImplicitGrantLogin(config);
return loginProvider;
}
function createAppChrome(loginProvider) {
var ItemtoAdd = {
"Customized Item 1": "http://www.contoso.com/item1", // put your customized item 1 page
"Customized Item 2": "http://www.contoso.com/item2", // put your customized item 2 page
"Customized Item 3": "http://www.contoso.com/item3" // put your customized item 3 page
};
options = new Object();
options.appHomeUrl = "https://localhost:44343/Account/signin-oidc"; // put your home page url
options.customizedItems = ItemtoAdd;
var appChrome =
new Office.Controls.AppChrome("Contoso App", document.getElementById('container'), loginProvider, options);
}
异常详情
System.Exception: Correlation failed.
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.<HandleRequestAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()