Oauth 通过WebAuthenticationBroker登录后,应用程序挂起在恢复屏幕上

Oauth 通过WebAuthenticationBroker登录后,应用程序挂起在恢复屏幕上,oauth,windows-phone-8.1,fitbit,Oauth,Windows Phone 8.1,Fitbit,更新:这似乎只有在模拟器中运行应用程序时才会发生。当我在真实设备上运行它时,一切都按预期工作 我在我的应用程序中使用,让用户通过OAuth向Fitbit进行身份验证 WebAuthenticationBroker成功地将args(即包含令牌和密码的最终URI)传递给我,我可以进行后续调用,从Fitbit检索访问令牌。所有这些都有效 我的问题是,应用程序然后挂在“恢复…”屏幕上。这发生在WebAuthenticationBroker Fitbit登录屏幕消失之后,与在此之后执行的任何代码无关。我

更新:这似乎只有在模拟器中运行应用程序时才会发生。当我在真实设备上运行它时,一切都按预期工作


我在我的应用程序中使用,让用户通过OAuth向Fitbit进行身份验证

WebAuthenticationBroker成功地将args(即包含令牌和密码的最终URI)传递给我,我可以进行后续调用,从Fitbit检索访问令牌。所有这些都有效

我的问题是,应用程序然后挂在“恢复…”屏幕上。这发生在WebAuthenticationBroker Fitbit登录屏幕消失之后,与在此之后执行的任何代码无关。我已经删除了所有的代码,它仍然发生

我用来启动WebAuthenticationBroker的调用是

string CallBackUrl = "http://localhost:8080/Fitbit/Callback";

string oauth_token = await GetFitbitRequestTokenAsync(CallBackUrl, ConsumerKey);

string FitbitUrl = "https://www.fitbit.com/oauth/authorize?oauth_token=" + oauth_token;

System.Uri StartUri = new Uri(FitbitUrl);
System.Uri EndUri = new Uri(CallBackUrl);

WebAuthenticationBroker.AuthenticateAndContinue(StartUri, EndUri, null, WebAuthenticationOptions.None);
我想我错过了所有这些之后的一个步骤,这是返回我的应用程序页面所需要的。我已经尝试了我能想到的各种方法,但我不确定我需要在哪里以及如何做才能让它工作

我从WebAuthenticationManager获取带有令牌/秘密参数的回调URL的方法是

protected async override void OnActivated(IActivatedEventArgs e)
{
    base.OnActivated(e);

    var args = e as IContinuationActivatedEventArgs;
    if (args != null && args.Kind == ActivationKind.WebAuthenticationBrokerContinuation)
    {
        Frame rootFrame = Window.Current.Content as Frame;
        var wabPage = rootFrame.Content as IWebAuthenticationContinuable;
        wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs);
    }

    Window.Current.Activate();
}
非常感谢您的帮助!:)


_rndsum

WP的最低手机版本是8.1,您可能应该删除Windows-phone-8标签。谢谢,我已经删除了它。我面临着同样的问题-说真的,唯一的选择是在真正的设备上调试它?Cmon,必须有一个解决方案。整个WinRT平台都很糟糕,这使得开发WP应用程序变得非常苛刻——Silverlight更稳定,更可预测。