0
votes

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?

1
What is the error it gives you? If you show the JavaScript Console, are there any error messages within the console? - Adrian Hall

1 Answers

1
votes

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/