How to use the firebase.initializeApp function in firebase

To help you get started, we’ve selected a few firebase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / firebase_v4.x.x / flow_v0.34.x-v0.45.x / test_firebase.js View on Github external
// @flow

import firebase from 'firebase';
import app from 'firebase/app';
import auth from 'firebase/auth';
import database from 'firebase/database';

// #1
const a1: firebase.app.App = firebase.initializeApp({
  apiKey: 'apiKey',
  databaseURL: 'databaseURL',
  projectId: '42',
});

// #2
// $ExpectError
const a2: firebase.app.App = firebase.initializeApp({
  storageBucker: 'storageBucket',
  projectId: '42',
});

// #3
const a3: app.App = app('DEFAULT');

// #4
github jsayol / FireSQL / tools / test-data / test-setup.ts View on Github external
JSON.stringify(config, null, 2)
    );

    // Deploy database rules
    task = showTask('Deploying Firestore indexes and security rules');
    await firebaseTools.deploy({
      project,
      token,
      cwd: resolvePath(__dirname, '../../config')
    });

    // Firestore calls grpc.load() which has been deprecated and we
    // get an ugly warning on screen. This mutes it temporarily.
    const unmute = muteDeprecationWarning();

    const firestore = firebase.initializeApp(config).firestore();
    firestore.settings({ timestampsInSnapshots: true });
    const rootRef = firestore.doc('/');

    task = showTask('Deleting "shops" collection');
    await firebaseTools.firestore.delete('/shops', {
      project,
      yes: true,
      recursive: true
    });

    task = showTask('Loading test data into "shops" collection');
    await loadTestDataset(rootRef, loadJSONFile(
      './data.json'
    ) as TestCollection[]);

    unmute();
github andrewjmead / react-course-2-expensify-app / src / firebase / firebase.js View on Github external
import * as firebase from 'firebase';

const config = {
  apiKey: process.env.FIREBASE_API_KEY,
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
  databaseURL: process.env.FIREBASE_DATABASE_URL,
  projectId: process.env.FIREBASE_PROJECT_ID,
  storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
  messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID
};

firebase.initializeApp(config);

const database = firebase.database();
const googleAuthProvider = new firebase.auth.GoogleAuthProvider();

export { firebase, googleAuthProvider, database as default };

// // child_removed
// database.ref('expenses').on('child_removed', (snapshot) => {
//   console.log(snapshot.key, snapshot.val());
// });

// // child_changed
// database.ref('expenses').on('child_changed', (snapshot) => {
//   console.log(snapshot.key, snapshot.val());
// });
github nuxt-community / hackernews-nuxt-ts / api / create-api-server.js View on Github external
export async function createAPI({ config, version }) {
  let api
  // this piece of code may run multiple times in development mode,
  // so we attach the instantiated API to `process` to avoid duplications
  if (process.__API__) {
    api = process.__API__
  } else {
    Firebase.initializeApp(config)
    api = process.__API__ = Firebase.database().ref(version)

    api.onServer = true

    // fetched item cache
    api.cachedItems = LRU({
      max: 1000,
      maxAge: 1000 * 60 * 15 // 15 min cache
    })

    // cache the latest story ids
    api.cachedIds = {}
    ;["top", "new", "show", "ask", "job"].forEach(type => {
      api.child(`${type}stories`).on("value", snapshot => {
        api.cachedIds[type] = snapshot.val()
      })
github mhalle / oabrowser / src / ng-providers / firebaseViewService.js View on Github external
undoRedoManager,
        viewSync = true,
        config = {
            apiKey: "AIzaSyD3pMiEmPlkA1SZfYywK_JxtT6ruzyfk3k",
            authDomain: "atlas-viewer.firebaseapp.com",
            databaseURL: "https://atlas-viewer.firebaseio.com",
            storageBucket: "firebase-atlas-viewer.appspot.com",
        },
        rootRef,
        auth,
        providers,
        currentAtlasStructurePath;


    //initializeApp (SDK v3)
    firebase.initializeApp(config);
    rootRef = firebase.database().ref();
    auth = firebase.auth();



    providers = {
        twitter : new firebase.auth.TwitterAuthProvider(),
        google : new firebase.auth.GoogleAuthProvider(),
        github : new firebase.auth.GithubAuthProvider(),
        facebook : new firebase.auth.FacebookAuthProvider()
    };

    providers.google.addScope('https://www.googleapis.com/auth/userinfo.email');
    providers.google.addScope('https://www.googleapis.com/auth/userinfo.profile');
    providers.github.addScope('user:email');
    providers.facebook.addScope('public_profile');
github Enegrecer / enegrecer-web / src / utils / firebaseUtils.js View on Github external
import * as firebase from 'firebase';

const config = {
  apiKey: 'AIzaSyDBiMFbhXtZudaEzdrASgnLtSwx94dXVB8',
  authDomain: 'enegrecer-e37b3.firebaseapp.com',
  databaseURL: 'https://enegrecer-e37b3.firebaseio.com',
  projectId: 'enegrecer-e37b3',
  storageBucket: 'enegrecer-e37b3.appspot.com',
  messagingSenderId: '762507318866',
};

const firebaseApp = firebase.initializeApp(config);
export default firebaseApp;

export const auth = firebase.auth();
export const ref = firebase.database().ref();
github gokulkrishh / anonymous-web / src / App.js View on Github external
import React, { Component } from "react";
import reactMixin from "react-mixin";
import Message from "./Message";
import Header from "./Header";
import Modal from "./Modal";
import Input from "./Input";
import Spinner from "./Spinner";
import Intro from "./Intro";
var firebase = require("firebase");
import ReactFireMixin from "reactfire";

const config = require("./config.json");
firebase.initializeApp(config);

export default class App extends Component {
  constructor(props) {
    super(props);
    this.closeChat = this.closeChat.bind(this);
    this.hideModal = this.hideModal.bind(this);
    this.addToQueue = this.addToQueue.bind(this);
    this.initializeChat = this.initializeChat.bind(this);
    this.showSpinner = this.showSpinner.bind(this);
    this.offlineEvent = this.offlineEvent.bind(this);
    this.showIntroCallback = this.showIntroCallback.bind(this);
    this.hideIntroCallback = this.hideIntroCallback.bind(this);
    this.firebaseChatsRef = null;
    this.firebaseDB = firebase.database();
    this.addChat = null;
    this.isUserVisitedBefore = !localStorage.getItem("visited");
github goblinbr / manager-react-native-app / src / App.js View on Github external
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import firebase from 'firebase';
import ReduxThunk from 'redux-thunk';
import reducers from './reducers';
import { AppWithNavigationState } from './AppWithNavigationState';

const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));

firebase.initializeApp({
  apiKey: 'AIzaSyBLjeVwu0m3UEFDujxX0t6ZuX-3D8LeJRU',
  authDomain: 'manager-react-native-app.firebaseapp.com',
  databaseURL: 'https://manager-react-native-app.firebaseio.com',
  storageBucket: 'manager-react-native-app.appspot.com',
  messagingSenderId: '679440854575'
});

class App extends Component {
  render() {
    return (
      
        
      
    );
  }
}
github n6g7 / redux-saga-firebase / example / src / redux / rsf.js View on Github external
import firebase from 'firebase'
import '@firebase/firestore'
import ReduxSagaFirebase from 'redux-saga-firebase'

const firebaseApp = firebase.initializeApp({
  apiKey: 'AIzaSyCSTkbHZIcJluamfb69ShSHXn8351H9Vm0',
  authDomain: 'redux-saga-firebase.firebaseapp.com',
  databaseURL: 'https://redux-saga-firebase.firebaseio.com',
  projectId: 'redux-saga-firebase',
  storageBucket: 'redux-saga-firebase.appspot.com',
  messagingSenderId: '231632772443',
})

const rsf = new ReduxSagaFirebase(firebaseApp)

export default rsf
github oneut / async-react-router / examples / ssr-with-redux / src / app / api / HackerNewsApi.js View on Github external
constructor() {
    this.displayNumber = 20;

    Firebase.initializeApp({
      databaseURL: "https://hacker-news.firebaseio.com"
    });
    this.api = Firebase.database().ref("/v0");
    this.cache = LRU({
      max: 500,
      maxAge: 1000 * 60 * 60
    });
  }