Ionic2 Facebook login error


#1

I am trying to integrate facebook login into my application.
This is the call I am making:

$scope.doFBLogin = function(){
Ionic.Auth.login(‘facebook’, {‘remember’: true}).then(FBsuccess, authFailure);
};

var FBsuccess = function(user){
console.log(‘Successfuly logged in with FB’);
console.dir(user);
};

var authFailure = function(errors) {
console.dir(errors);
};

I have installed the cordova-plugin-inappbrowser.
I am trying to login from my mobile.

And this is the error I am getting:

POST https://api.ionic.io/auth/login/facebook 404 (Not Found)
2016-06-10 18:57:10.556 loginCtrl.js:88 SyntaxError: Unexpected end of JSON input
at Object.parse (native)
at u (file:///android_asset/www/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js:1:3955)
at XMLHttpRequest.r (file:///android_asset/www/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js:1:3440)

Below is the system information:

Your system information:

Cordova CLI: 6.2.0
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Framework Version: 1.2.4
Ionic CLI Version: 1.7.15
Ionic App Lib Version: 0.7.2
OS:
Node Version: v4.4.1

May I know why it is not able to find the API Endpoint?
Any help would be appreciated


#3

Try to make it this way
var authSettings = { ‘remember’: true };
Ionic.Auth.login(‘facebook’, authSettings).then(FBsuccess, authFailure);


#4

No use it is the same error.
For some reason it is not able to reach the api endpoint:
https://api.ionic.io/auth/login/facebook


#5

Nevermind the solution was to install cordova whitelist plugin.