Azure Active Directory AcquireTokenAsync 不触发事件
Azure Active Directory AcquireTokenAsync doesn't trigger event
基于本教程 http://www.cloudidentity.com/blog/2014/08/28/use-adal-to-connect-your-universal-apps-to-azure-ad-or-adfs/ 我正在尝试将我的通用应用程序与 Azure Active Directory 连接起来。不幸的是 Windows Phone 8.1 应用程序无法完全正常工作。
一切顺利(当我点击两次按钮时我可以成功登录,因为他第二次获得 "silent" 令牌并且方法 AfterLogin 被执行)但是函数 AcquireTokenAsync 中的事件在我之后没有被触发将我的凭据放入 window.
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));
}
AfterLogin 在 ac.AcquireTokenAndContinue() 结束它的工作后没有执行有什么问题?
您是否使用 Windows Phone 示例 https://github.com/AzureADSamples/NativeClient-WindowsPhone8.1 作为起点?在将示例集成到通用应用程序解决方案之前,示例是否可以自行运行?我建议在 App.xaml.cs 代码中添加断点,以确保正确连接后续事件。
基于本教程 http://www.cloudidentity.com/blog/2014/08/28/use-adal-to-connect-your-universal-apps-to-azure-ad-or-adfs/ 我正在尝试将我的通用应用程序与 Azure Active Directory 连接起来。不幸的是 Windows Phone 8.1 应用程序无法完全正常工作。
一切顺利(当我点击两次按钮时我可以成功登录,因为他第二次获得 "silent" 令牌并且方法 AfterLogin 被执行)但是函数 AcquireTokenAsync 中的事件在我之后没有被触发将我的凭据放入 window.
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));
}
AfterLogin 在 ac.AcquireTokenAndContinue() 结束它的工作后没有执行有什么问题?
您是否使用 Windows Phone 示例 https://github.com/AzureADSamples/NativeClient-WindowsPhone8.1 作为起点?在将示例集成到通用应用程序解决方案之前,示例是否可以自行运行?我建议在 App.xaml.cs 代码中添加断点,以确保正确连接后续事件。