0

I have a windows phone 8.1 app and I'm trying to do Google Auth using either Azure Mobile Services Auth or Google Auth library and it fails using both methods returning a 400 error. I get to the sign-in page and after signing in it returns the 400 and does not take me to the consent page.

Here's my Google Auth code:

        IConfigurableHttpClientInitializer credential; 
        var clientSecrets = new Uri(Settings.GoogleClientSecretsUri, UriKind.Absolute);
        var scopes = new[] {CalendarService.Scope.Calendar};

        credential = await GoogleWebAuthorizationBroker
            .AuthorizeAsync(
                clientSecrets,
                scopes, 
                "user", 
                CancellationToken.None
           );

        Initializer = new BaseClientService.Initializer{
            HttpClientInitializer = credential,
            ApplicationName = Settings.ApplicationName

Azure Auth is very stright forward one line code

        azureClient.LoginAsync(MobileServiceAuthenticationProvider.Google);

My Azure Auth code is working fine for Facebook and Microsoft Account. My redirect Uri on the google developer console is of https://todolist.azure-mobile.net/signin-google format and I also tried https://todolist.azure-mobile.net/login/google. Has anyone been successful in using Google Auth on a Windows Phone?

nimatra
  • 604
  • 8
  • 19
  • You could try picking apart Googles .net client lib see how they are doing it. 400 error means that there is something seriously wrong with your request. Could be anything from the formatting of the client id or client secrete. Why not use Google's client lib? – Linda Lawton - DaImTo Mar 24 '15 at 07:16
  • The google Auth code that I posted are using google .net libraries. And for the client secrets I downloaded the json file that google generates. So Google library is reading google generated json file – nimatra Mar 24 '15 at 08:19
  • Look at the sample: https://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122 – kiewic Mar 25 '15 at 17:21

0 Answers0