簡體   English   中英

Windows Phone的Azure移動服務的身份驗證問題

[英]Authentication issues with Azure Mobile Service for Windows Phone

我正在嘗試使用Azure移動服務的身份驗證提供程序與Google進行身份驗證。 我已經按照文檔( http://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-windows-phone-get-started-users/ )中的教程進行了操作並已將其應用到我的應用程序的登錄屏幕。 它的確顯示了Google的登錄提示,我輸入了憑據並單擊“登錄”。然后,它返回我的應用程序的登錄屏幕,而不是征求同意以期望的方式使用我的帳戶詳細信息。

我不確定發生了什么問題或如何找出問題所在。 我對Windows Phone開發和Visual Studio開發完全陌生,因此更習慣於Android開發和Eclipse。 這對我來說是新的,我迷路了。

這是我用於Google身份驗證的代碼。

private async System.Threading.Tasks.Task aaGoogle()
{
    while (user == null)
    {
        string message;
        try
        {
            user = await App.MobileService
                .LoginAsync(MobileServiceAuthenticationProvider.Google);
            message = string.Format("You are now logged in - {0}", user.UserId);
        }
        catch (InvalidOperationException)
        {
            message = "You must log in. Login Required";
        }

        var dialog = new MessageDialog(message);
        dialog.Commands.Add(new UICommand("OK"));
        await dialog.ShowAsync();
    }
}

嗯,Microsoft的文檔不完整。 我正在為我的應用程序使用.NET后端和C#,並且為Javascript后端設置了默認的回調URL。 因此,.NET后端的正確回調URL為:

  • [mobileservice] .azure-mobile.net /登入-嘰嘰喳喳
  • [mobileservice] .azure-mobile.net /登入Facebook的
  • [mobileservice] .azure-mobile.net /登入-谷歌
  • [mobileservice] .azure-mobile.net /登入微軟

將鏈接更改為所有相關服務的鏈接后,登錄屏幕和同意屏幕完美運行,我得到了每個帳戶的登錄詳細信息。 一切正常。 我希望這可以幫助其他人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM