Robert Kwon February 2016

Google login redirect error with Azure Mobile Service Javascript client SDK

When my web client tried to login google with Azure Mobile Javascript sdk, it gave me an error.

<html>
<head>
  <script src="https://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.7.min.js"></script>

  <script> 
  function signIn(){    
     var MobileServiceClient = WindowsAzure.MobileServiceClient;
     var client = new MobileServiceClient('https://thehome.azurewebsites.net', 'xxxx');

    client.login("google").done(function (results) {
         alert("You are now logged in as: " + results.userId);
    }, function (err) {
        alert("Error: " + err);
    });
  }
  </script>

</head>

<body>
    <button onclick="signIn()">Click me</button>
</body>

</html>

I used sample code from https://azure.microsoft.com/en-us/documentation/articles/mobile-services-html-how-to-use-client-library/ . If I click the button, I got below error.

Cannot GET /login/google?completion_type=postMessage&completion_origin=https%3A%2F%2Fthehome.azurewebsites.net

My iOS application works well with server app, but only web client has this problem.

Any suggestions?

Answers


Bruno Medina February 2016

Remember that login with a provider like Google does a ping from their servers to your server after the login.

Right now, it's complaining that your service in azure thehome is not there.

Please follow this guide to configure your Google account to make it work with Mobile Services:

https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-google-authentication/

Post Status

Asked in February 2016
Viewed 2,957 times
Voted 6
Answered 1 times

Search




Leave an answer