针对Google OAuth的Windows Azure移动服务身份验证失败-400错误

针对Google OAuth的Windows Azure移动服务身份验证失败-400错误,azure,windows-phone-8,google-oauth,azure-mobile-services,google-authentication,Azure,Windows Phone 8,Google Oauth,Azure Mobile Services,Google Authentication,我从Azure移动服务开始,除了谷歌,所有提供商的认证都很好 我已为web应用创建了客户端ID: 然后在Windows Azure移动服务面板上对其进行配置: 然后,我创建了新的Windows Phone 8应用程序,添加了Azure移动服务nuget软件包,并编写了几行代码: private MobileServiceUser _googleUser; private async System.Threading.Tasks.Task AuthenticateGoogl

我从Azure移动服务开始,除了谷歌,所有提供商的认证都很好

我已为web应用创建了客户端ID:

然后在Windows Azure移动服务面板上对其进行配置:

然后,我创建了新的Windows Phone 8应用程序,添加了Azure移动服务nuget软件包,并编写了几行代码:

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

                MessageBox.Show(message);
            }
        }
但每次调用AuthenticateGoogle方法时,我都会收到400个错误

System.InvalidOperationException: Authentication failed with HTTP response code 400.
   at Microsoft.WindowsAzure.MobileServices.AuthenticationBroker.<AuthenticateAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.WindowsAzure.MobileServices.MobileServiceAuthentication.<LoginAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at PhoneApp1.SSOPage.<AuthenticateGoogle>d__19.MoveNext()
System.invalidoOperationException:身份验证失败,HTTP响应代码为400。
在Microsoft.WindowsAzure.MobileServices.AuthenticationBroker.b_u0()上
在System.Threading.Tasks.Task`1.InnerInvoke()中
在System.Threading.Tasks.Task.Execute()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()中
在Microsoft.WindowsAzure.MobileServices.MobileServiceAuthentication.d_u0.MoveNext()上
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()中
在PhoneApp1.SSOPage.d_u19.MoveNext()中

我做错了什么?

我觉得不错。我所做的步骤基本上与您遵循的教程相同。我在Google上遇到了麻烦,所以我只是去了Google开发者控制台,创建了一个新的客户端ID,然后用旧的密钥替换了新的密钥。我还包括了相同的URL,但作为http://而不是https://的,但是当我看到它再次开始工作后,我去掉了http://并且它仍然工作


除此之外,请确保所有内容拼写正确,祝您好运。

我可以看到它是为web应用程序创建的。如果我错了,请告诉我。此外,我在这本指南中找到了说明:对不起,我没有理解你。在我的问题中,有一张直接从google开发控制台“web应用程序的客户端Id”拍摄的图片。你能说清楚一点吗?