Ionic 2 facebook integration documentation/example for apps.ionic.io

Hello I am trying to implement the facebook login using the ionic services but the documentation is not clear on the details, or maybe I am missing something…

Does anyone have a working example?

This from the documentation

Injecting FacebookAuth and User

Import FacebookAuth and User from the Cloud Client and specify them as dependencies in your component constructor.

facebookAuth is a service that deals with user authentication.
user is a reference to the current user, whether that user is anonymous or authenticated.
import { Component } from ‘@angular/core’;
import { FacebookAuth, User } from ‘@ionic/cloud-angular’;

@Component( … )
export class LoginPage {
constructor(public facebookAuth: FacebookAuth, public user: User) {

}
}

Login
this.facebookAuth.login().then( … );

Logout
Logging out clears the current user context.

this.facebookAuth.logout();

Hi there,

How coincidental! I’ve just finished a video on this exact topic.

Facebook Authentication with Ionic 2/Ionic Cloud

Happy to answer any questions regarding the implementation of this.

hello, Excelent tutorial. Just wanted to ask you how where you able to debug this on your local environment? I am only able to test this on the real device. Thanks!

Thanks a lot!

I was doing it by getting access to the JavaScript console of the device by using: chrome://inspect in your address bar.

You’ll then be able to access the console of any debug version WebView app.

Paul

Hi, nice movie. I followed the instructions but unfortunately I get an empty error object after pressing ‘continue’ in the Facebook prompt.
When I press cancel I get an error object with the message that the user cancelled. But pressing continue thus results in an empty error… Do you have any idea why?