Google Login with ngCordova http://localhost/CallBack work on Ionic View?

Google Login with ngCordova http://localhost/CallBack work on Ionic View?

app.controller(“LoginCtrl”, function($scope, $cordovaOauth) {

$scope.googleLogin = function() {
    $cordovaOauth.google("Client_ID", 
      ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"])
    .then(function(result) {
        alert(JSON.stringify(result));
    }, function(error) {
        console.log(error);
    });
}

});

i created a button with ng-click=“googleLogin()” when i click this show me the google login after i do login i accept the permises and after it crash… why? http://localhost/CallBack work on Ionic View?

Thanks to all.

It does not work for me either.

Ah, ngCordovaOauth does not support ionic view or ionic serve. It has to be emulator or device.

1 Like

it works, you just need to set the Authorized JavaScript origins AND Authorized redirect URIs in your google Account in the console of google cloud service.

Authorized redirect URIs: http://localhost/callback.

it works for me. cheers.