first_open
in_app_purchase
firebase.initializeApp()
// DON'T DO THIS ANYMORE! switch (location.hostname) { case 'myapp.com': firebase.initializeApp(prodConfig); break; case 'myapp-staging.com': firebase.initializeApp(stagingConfig); break; default: firebase.initializeApp(devConfig); break; }
script
<!doctype html> <html> <body> ... <!-- Import and initialize the Firebase SDK --> <script src="/https/firebase.googleblog.com/__/firebase/3.7.4/firebase-app.js"></script> <script src="/https/firebase.googleblog.com/__/firebase/3.7.4/firebase-auth.js"></script> <script src="/https/firebase.googleblog.com/__/firebase/init.js"></script> <script> // The Firebase SDK is ready to rock! firebase.auth().onAuthStateChange(function(user) { /* … */ }); </script> </body> </html>
firebase serve
/__/firebase/{VERSION}/firebase-{app,auth,database,messaging,storage}.js
/__/firebase/{VERSION}/firebase.js
/__/firebase/init.js
/__/firebase/init.json
init.js
3.6.0
firebase deploy
firebase login --reauth
firebase setup:web
firebase-tools
$ npm install --save firebase-tools@^3.6
const fbcli = require('firebase-tools'); const fs = require('fs'); // by default, uses the current project and logged in user fbcli.setup.web().then(config => { fs.writeFileSync( 'build/initFirebase.js', `firebase.initializeApp(${JSON.stringify(config)});` ); }); // alternatively, you can pass project or token information fbcli.setup.web({ project: 'my-custom-project', token: process.env.FIREBASE_TOKEN });
import firebase_admin from firebase_admin import credentials cred = credentials.Certificate("path/to/service.json") firebase_admin.initialize_app(cred)
firebase_admin.initialize_app()
uid = "some-uid" additional_claims = { "premiumAccount": True } custom_token = auth.create_custom_token(uid, additional_claims)
decoded_token = auth.verify_id_token(id_token) uid = decoded_token["uid"]