简体   繁体   English

Windows Phone的Azure移动服务的身份验证问题

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

I am attempting authentication with Google using Azure Mobile Service's Authentication Providers. 我正在尝试使用Azure移动服务的身份验证提供程序与Google进行身份验证。 I have followed the tutorial in the documentation ( http://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-windows-phone-get-started-users/ ) and have applied it to my app's login screen. 我已经按照文档( http://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-windows-phone-get-started-users/ )中的教程进行了操作并已将其应用到我的应用程序的登录屏幕。 It does show a login prompt for Google, and I enter credentials and click sign in. Then instead of asking for consent to use my account details like expected, it goes back to my app's login screen. 它的确显示了Google的登录提示,我输入了凭据并单击“登录”。然后,它返回我的应用程序的登录屏幕,而不是征求同意以期望的方式使用我的帐户详细信息。

I'm not sure what's wrong, or how to figure out what's wrong. 我不确定发生了什么问题或如何找出问题所在。 I am somewhat new to Windows Phone development, and development in Visual Studio at all, being more used to Android development and Eclipse. 我对Windows Phone开发和Visual Studio开发完全陌生,因此更习惯于Android开发和Eclipse。 This is new to me, and I'm lost. 这对我来说是新的,我迷路了。

Here's the code I use for Google authentication. 这是我用于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();
    }
}

Ah, Microsoft's documentation is incomplete. 嗯,Microsoft的文档不完整。 I'm using a .NET backend and C# for my app, and the default callback URLs are made for the Javascript backend. 我正在为我的应用程序使用.NET后端和C#,并且为Javascript后端设置了默认的回调URL。 So the correct callback URLs for the .NET backend are: 因此,.NET后端的正确回调URL为:

  • [mobileservice].azure-mobile.net/signin-twitter [mobileservice] .azure-mobile.net /登入-叽叽喳喳
  • [mobileservice].azure-mobile.net/signin-facebook [mobileservice] .azure-mobile.net /登入Facebook的
  • [mobileservice].azure-mobile.net/signin-google [mobileservice] .azure-mobile.net /登入-谷歌
  • [mobileservice].azure-mobile.net/signin-microsoft [mobileservice] .azure-mobile.net /登入微软

After changing the links to those for all of the relevant services, the login screens and consent screens worked perfectly, and I got the login details for each account. 将链接更改为所有相关服务的链接后,登录屏幕和同意屏幕完美运行,我得到了每个帐户的登录详细信息。 Everything works as intended. 一切正常。 I hope this helps someone else. 我希望这可以帮助其他人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从不同项目访问Windows Phone上的Azure移动服务 - Accessing Azure Mobile Service on Windows Phone from Different Projects Windows Phone 8.1应用程序将文件上传到Azure移动应用程序服务 - Windows Phone 8.1 app upload a file to azure mobile app service Azure移动服务需要身份验证吗? - Azure Mobile Service required Authentication? Windows Azure移动服务:InsertAsync - Windows Azure Mobile Service: InsertAsync Windows Phone 7访问Azure移动服务(远程服务器返回错误:未找到) - Windows Phone 7 access Azure Mobile Service (The remote server returned an error: not found) 将用户ID从Windows Phone 8.1应用发送到Azure移动服务 - Send User ID from Windows Phone 8.1 App to Azure Mobile Service 使用Azure移动服务的现有Windows 10 UWP App的Google身份验证 - Google Authentication For Existing Windows 10 UWP App Using Azure Mobile Service Windows Phone将图像上传到Azure Blob服务 - Windows Phone uploading images to azure blob service 具有Windows身份验证的WCF服务已移至Azure - WCF service with Windows Authentication moved to Azure 带有Windows Azure移动服务的Windows Phone 8原始通知 - Windows Phone 8 Raw Notification with Windows Azure Mobile Services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM