import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
const config = {
apiKey: "******************************************",
authDomain:"******************************************",
databaseURL:"******************************************",
projectId: "******************************************",
storageBucket:"******************************************",
messagingSenderId:"******************************************",
appId: "******************************************",
measurementId: "******************************************"
};
export const createUserProfileDocument = async (userAuth,additionalData) => {
if(!userAuth) return;
const ref = firestore.doc(`users/${userAuth.uid}`);
const snapshot =await ref.get();
if(!snapshot.exists){
const { displayName,email } = userAuth;
const createdAt = new Date();
try{
await ref.set({displayName,email,createdAt,...additionalData})
}catch(error){
console.log("Error encountered while creating the user : ", error.message);
}
}
return ref;
//console.log(data);
}
firebase.initializeApp(config);
export const auth = firebase.auth();
export const firestore = firebase.firestore();
const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({prompt:'select_account'});
export const signInWithGoogle = () => auth.signInWithPopup(provider);
export default firebase;
This give a popup in a browser, but this does not work in app, i want to do this in ionic app, is der any solution for this???
1 post - 1 participant