Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loginWithFB(userData) {
- this.fb.login(['email', 'public_profile']).then((response: FacebookLoginResponse) => {
- this.fb.api('me?fields=id,name,email,first_name,picture.width(720).height(720).as(picture_small)', []).then(profile => {
- this.userData = { email: profile['email'], first_name: profile['first_name'], picture: profile['picture_small']['data']['url'], username: profile['name'] }
- if (this.userData != "") {
- this.navCtrl.setRoot(HomePage, { 'logfb': this.userData })
- this.events.publish('loginfacebook', this.userData, Date.now());
- // this.navCtrl.push(HomePage, {
- // 'logfb': this.userData
- // });
- } else {
- let toast = this.toastCtrl.create({ duration: 3000, position: 'bottom'
- });
- toast.setMessage('Não foi possível logar com Facebook');
- toast.present();
- }
- })
- });
Add Comment
Please, Sign In to add comment