Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public ngOnInit(): void {
firebase.initializeApp({
apiKey: 'AIzaSyA9tQLQ5WJOBS7-e9zcdGkRKjaroRI0T18',
authDomain: 'test-59779.firebaseapp.com',
databaseURL: 'https://test-59779.firebaseio.com',
projectId: 'test-59779',
storageBucket: '',
messagingSenderId: '289255988111',
})
this.message = GTG
this.renderer.setStyle(this.document.body.parentElement, 'background', 'green')
// use e2e ready since firebase uses an interval to poll for auth updates, which breaks protractor's angular
// ready detection
ready()
}
import { firebase } from '@firebase/app';
import '@firebase/database';
// Firebase config for storing messages from the contact form.
// Replace this with your own config or remove the form if you're
// checking out or modifying my protfolio – HW
import config from '../config';
const firebaseConfig = config.firebase;
export default firebase.initializeApp(firebaseConfig);
import UAParser from 'ua-parser-js';
import wkn from 'wkn';
import constants from '../constants';
import firebaseConf from '../configs/firebase';
const parser = new UAParser();
const browserName = parser.getBrowser().name;
const osName = parser.getOS().name;
const deviceType = parser.getDevice().type;
let database;
let auth;
let messaging;
let storage;
if (process.env.NODE_ENV !== 'test') {
firebase.initializeApp(firebaseConf);
database = firebase.database();
auth = firebase.auth();
if (constants.SUPPORTEDBROWSERS.indexOf(browserName) >= 0 && osName !== 'iOS') { // safari,iosではエラーになるため
messaging = firebase.messaging();
}
storage = firebase.storage();
}
export default {
/**
* firebaseのdatabaseを返します。
*/
getDatabase() {
return database;
},
/**
export const initializeFirebase = callback => {
try {
const senderId = process.env.REACT_APP_FIREBASE_SENDER_ID;
if(!senderId){
throw new Error("FIREBASE_SENDER_ID is missing. Please add it to environment variables.");
}
firebase.initializeApp({ messagingSenderId: senderId});
const messagingKey = process.env.REACT_APP_FIREBASE_MESSAGING_PUSH_KEY;
if(!messagingKey){
throw new Error("FIREBASE_MESSAGING_PUSH_KEY is missing. Please add it to environment variables.");
}
const messaging = firebase.messaging();
messaging.usePublicVapidKey(messagingKey);
messaging.onMessage(function(payload) {
console.log("Message received. ", payload);
callback(payload);
});
} catch (err) {
console.error("Unable to initialize firebase. " + err);
}
};
import { firebase } from '@firebase/app';
import 'firebase/auth';
import 'firebase/database';
const config = {
apiKey: 'AIzaSyD_B8LAxG-1IlfrlZwN5HAbncuwHrCZxU8',
authDomain: 'gdg-kl.firebaseapp.com',
databaseURL: 'https://gdg-kl.firebaseio.com',
projectId: 'gdg-kl',
storageBucket: 'gdg-kl.appspot.com',
messagingSenderId: '824291119922'
};
firebase.initializeApp(config);
export default firebase;
import {firebase} from '@firebase/app';
import '@firebase/auth';
import '@firebase/database';
import config from '../config';
const appFirebase = firebase.initializeApp({
apiKey: config.firebaseApiKey,
authDomain: `${config.firebaseApp}.firebaseapp.com`,
databaseURL: `https://${config.firebaseApp}.firebaseio.com`,
});
const auth = firebase.auth(appFirebase);
const database = firebase.database(appFirebase);
const githubAuthProvider = new firebase.auth.GithubAuthProvider();
githubAuthProvider.addScope('gist');
githubAuthProvider.addScope('public_repo');
export {auth, database, githubAuthProvider};
static newInstance(config: ServicesConfiguration): ServicesProvider {
const remote = require('electron').remote as any;
firebase.initializeApp(config);
return remote.app.serviceProvider
}
}
public instance() {
let fbApp;
if (!firebase.apps.length) {
fbApp = firebase.initializeApp(this.appConfig);
} else {
fbApp = firebase.app();
}
return fbApp;
}
constructor(config: FirebaseConfig) {
firebase.initializeApp(config);
this.firebase = firebase
}