I did this stuff below
import { Component } from '@angular/core';
import { NavController,Platform, LoadingController} from 'ionic-angular';
import { SharedService } from '../../providers/sharedservice/sharedservice';
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
import { QuestionPage } from '../question/question';
import { GooglePlus } from '@ionic-native/google-plus';
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
questionPage=QuestionPage;
constructor(public loadingCtrl: LoadingController,public navCtrl: NavController,public platform: Platform,public sharedService:SharedService, public fb:Facebook, private googlePlus: GooglePlus) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
fb_login()
{
// Login with permissions
this.fb.login(['public_profile', 'user_photos', 'email', 'user_birthday'])
.then( (res: FacebookLoginResponse) => {
// The connection was successful
if(res.status == "connected") {
// Get user ID and Token
var fb_id = res.authResponse.userID;
var fb_token = res.authResponse.accessToken;
// Get user infos from the API
this.fb.api("/me?fields=name,gender,birthday,email", []).then((user) => {
// Get the connected user details
var gender = user.gender;
var birthday = user.birthday;
var name = user.name;
var email = user.email;
console.log("=== USER INFOS ===");
console.log("Gender : " + gender);
console.log("Birthday : " + birthday);
console.log("Name : " + name);
console.log("Email : " + email);
// => Open user session and redirect to the next page
this.navCtrl.push(this.questionPage);//I have to send data to this page
});
}
// An error occurred while loging-in
else {
console.log("An error occurred...");
}
})
.catch((e) => {
console.log('Error logging into Facebook', e);
});
}
//My google login code start
g_login(){
if(this.platform.is('ios')){
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
}else{
this.googlePlus.login({
'webClientId': '********-i5v3********tdj7gbmmkhj6s7vr.apps.googleusercontent.com'
})
.then(res => console.log(res))
.catch(err => console.error(err));
}
}
//My google logini code End
}
Error Code 12500