I'm starting with Azure Mobile Service and authentication with all the providers works great except Google.
I have created Client ID for web apps: https://db.tt/s43Gi7ie
Then configured it at the Windows Azure Mobile Service panel: https://db.tt/ri3VzYFD
Then I created new Windows Phone 8 app, add Azure Mobile Services nuget package and wrote several lines of code:
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);
}
}
But every time I'm calling the AuthenticateGoogle method I received 400 error.
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()
What am I doing wrong?