lib/functions/firebase.js
async function authWithFirebase(auth) {
    try {
        const config = {
            apiKey: constants.FIREBASE_DATABASE_PUBLIC_APIKEY,
            databaseURL: constants.FIREBASE_DATABASE_URL,
        };

        if (!firebase.apps.length) {
            firebase.initializeApp(config);
        }

        const credential = firebase.auth.GoogleAuthProvider.credential(auth.credentials.id_token);
        await firebase.auth().signInAndRetrieveDataWithCredential(credential);

        return true;
    } catch (err) {
        err.origin = 'authWithFirebase';
        await error.log(err);
        return false;
    }
}
async function authWithFirebase(auth) {
    try {
        const config = {
            apiKey: constants.FIREBASE_DATABASE_PUBLIC_APIKEY,
            databaseURL: constants.FIREBASE_DATABASE_URL,
        };

        if (!firebase.apps.length) {
            firebase.initializeApp(config);
        }

        const credential = firebase.auth.GoogleAuthProvider.credential(auth.credentials.id_token);
        await firebase.auth().signInAndRetrieveDataWithCredential(credential);

        return true;
    } catch (err) {
        err.origin = 'authWithFirebase';
        await error.log(err);
        return false;
    }
}
async function authWithFirebase ( auth ) { try { const config = { apiKey : constants . FIREBASE_DATABASE_PUBLIC_APIKEY , databaseURL : constants . FIREBASE_DATABASE_URL , } ; if ( ! firebase . apps . length ) { firebase . initializeApp ( config ) ; } const credential = firebase . auth . GoogleAuthProvider . credential ( auth . credentials . id_token ) ; await firebase . auth ( ) . signInAndRetrieveDataWithCredential ( credential ) ; return true ; } catch ( err ) { err . origin = 'authWithFirebase' ; await error . log ( err ) ; return false ; } }
Get firebase credentails

@param {google.auth.OAuth2} auth - An authorized OAuth2 client.
@returns {Promise} - Promise resolving a firebase credential
Get firebase credentails