[英]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为:
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.