thelinux.pro/punch_list/public/js/firebase.js

47 lines
1.2 KiB
JavaScript

const firebaseConfig = {
apiKey: "AIzaSyA4De5itV56yaOBfBW6Cnk3fS7skPmDCHM",
authDomain: "punchlist-1561043639952.firebaseapp.com",
databaseURL: "https://punchlist-1561043639952.firebaseio.com",
projectId: "punchlist-1561043639952",
storageBucket: "",
messagingSenderId: "999467953896",
appId: "1:999467953896:web:a4ded59b12ccb9ff"
};
firebase.initializeApp(firebaseConfig);
//var defaultProject = firebase.initializeApp(firebaseConfig);
//console.log(defaultProject.name);
var database = firebase.database();
function test() {
var item = database().ref('punch-items');
// item.orderByChild("priority")
console.log(item);
}
test();
// AUTH //
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});