首页 文章

Azure Active Directory AcquireTokenAsync不会触发事件

提问于
浏览
1

基于这个教程http://www.cloudidentity.com/blog/2014/08/28/use-adal-to-connect-your-universal-apps-to-azure-ad-or-adfs/我完全正确的工作 .

一切都很好(当我点击两次按钮时,我可以成功登录,因为他第二次获得“无声”令牌和方法AfterLogin已经执行)但是在我将凭证放入窗口后,函数AcquireTokenAsync中的事件不会被触发 .

private async void Button_Click(object sender, RoutedEventArgs e)
{
    var result = await ac.AcquireTokenSilentAsync("https://graph.windows.net", ClientId);
    if (result != null && result.Status == AuthenticationStatus.Success)
        AfterLogin(result);
    else
        ac.AcquireTokenAndContinue("https://graph.windows.net", ClientId, WebAuthenticationBroker.GetCurrentApplicationCallbackUri(), AfterLogin);
}

public void AfterLogin(AuthenticationResult result)
{
    if (result.Status == AuthenticationStatus.Success)
        Frame.Navigate(typeof(HubPage));
}

在ac.AcquireTokenAndContinue()结束它的工作后,AfterLogin没有执行是什么问题?

1 回答

  • 1

    您是否使用Windows Phone示例https://github.com/AzureADSamples/NativeClient-WindowsPhone8.1作为起点?在将其集成到通用应用程序解决方案之前,该示例是否可以自行运行?我建议在App.xaml.cs代码中添加断点,以确保正确连接延续事件 .

相关问题