Guys, I’m Brazilian, I’m having some difficulties …
The app logs in, but in the function show login details and logout I got error …
In this line: this.fb.api (’/’ + response.authResponse.userID + ‘? Fields = id, name, gender’, [],
And in this: this.fb.logout (function (response) {
I’m a beginner in ionic, how can I solve it?
[code]
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { Facebook, FacebookLoginResponse } from ‘@ionic-native/facebook’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
constructor(public navCtrl: NavController, private fb: Facebook) {
}
loginFacebook(){
this.fb.login([‘public_profile’, ‘user_friends’, ‘email’])
.then((res: FacebookLoginResponse) =>
console.log(res)
)
.catch(e => console.log(‘Error logging into Facebook’, e));
}
detailFacebook(){
this.fb.getLoginStatus()
.then((response) => {
//console.log(response.status);
if(response.status == "connected") {
this.fb.api('/' + response.authResponse.userID + '?fields=id,name,gender',[],
function onSuccess(result) {
alert(JSON.stringify(result));
},
function onError(error) {
alert(error);
}
);
console.log('logado');
}
else {
alert('Not logged in');
}
});
}
logoutFacebook(){
this.fb.logout(function(response) {
console.log('not');
});
}
}
[/code]