c# - AuthenticateAndContinue 错误 WP 8.1

标签 c# xaml authentication windows-runtime windows-phone-8.1

我正在尝试使用 WebAuthenticationBroker 的 AuthenticateAndContinue 方法在 Windows Phone 8.1 中执行身份验证。这是我执行身份验证的页面。

public sealed partial class ScenarioFrame : Page,IWebAuthenticationContinuable
{
    public static ScenarioFrame Current;
    public ScenarioFrame()
    {
        this.InitializeComponent();
        Current = this;
        Load();
    }

    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.
    /// This parameter is typically used to configure the page.</param>
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
        Load();
    }
    private void Load()
    {
        WebAuthenticationBroker.AuthenticateAndContinue(new Uri("https://manage.windowsazure.com/publishsettings/"),new Uri("https://manage.windowsazure.com/publishsettings/getpublishsettings"));
        Block.Visibility = Visibility.Visible;
    }
    public async void ContinueWebAuthentication(Windows.ApplicationModel.Activation.WebAuthenticationBrokerContinuationEventArgs args)
    {
        String resp = args.WebAuthenticationResult.ResponseData;
    }
}

为了使用 AndContinueMethod,我使用了 MSDN 上提供的 ContinuationManager 和 SuspensionManager。当用户单击 MainPage 中的按钮时,应用程序导航到 ScenarioFrame 页面。问题是回调后的 WebAuthenticationResult 在 WebAuthenticationStatus 属性 (UserCancel) 中给出错误并且响应为空。在我使用 AuthenticateAsync 方法的 Windows 8.1 应用程序中不会出现此问题。任何人都可以阐明如何解决这个问题吗?

最佳答案

WebAuthenticationBroker.AuthenticateAndContinue(new Uri("https://manage.windowsazure.com/publishsettings/"), new Uri("https://manage.windowsazure.com/publishsettings/getpublishsettings"),   null, WebAuthenticationOptions.None);

试试这个

关于c# - AuthenticateAndContinue 错误 WP 8.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26115377/

相关文章:

c# - 在同一线程中类的所有实例之间共享类的数据成员

c# - Xamarin Forms - 更新标签值

c# - 使用 WPF 绑定(bind)在深层嵌套的属性更改时获取回调

c# - 如何在输入文本框信息之前隐藏标签

php - 使用带 Ruby 的 Blowfish 验证在 PHP 中加密的密码

c# - 将 ODATA xml 序列化/反序列化为 C# 对象

c# - 每次运行后清除与 tracelistener 关联的日志?

authentication - Jersey 客户端 API - 身份验证

php - Zend Digest/Basic 身份验证不断失败

c# - 在功能区控件上绘制窗口按钮