MCPcopy Create free account
hub / github.com/firebase/quickstart-js / initApp

Function initApp

auth/chromextension/credentials.js:24–49  ·  view source on GitHub ↗

* initApp handles setting up the Firebase context and registering * callbacks for the auth status. * * The core initialization is in firebase.App - this is the glue class * which stores configuration. We provide an app name here to allow * distinguishing multiple app instances. * * This metho

()

Source from the content-addressed store, hash-verified

22 * When signed in, we also authenticate to the Firebase Realtime Database.
23 */
24function initApp() {
25 // Listen for auth state changes.
26 firebase.auth().onAuthStateChanged(function(user) {
27 if (user) {
28 // User is signed in.
29 var displayName = user.displayName;
30 var email = user.email;
31 var emailVerified = user.emailVerified;
32 var photoURL = user.photoURL;
33 var isAnonymous = user.isAnonymous;
34 var uid = user.uid;
35 var providerData = user.providerData;
36 document.getElementById('quickstart-button').textContent = 'Sign out';
37 document.getElementById('quickstart-sign-in-status').textContent = 'Signed in';
38 document.getElementById('quickstart-account-details').textContent = JSON.stringify(user, null, ' ');
39 } else {
40 // Let's try to get a Google auth token programmatically.
41 document.getElementById('quickstart-button').textContent = 'Sign-in with Google';
42 document.getElementById('quickstart-sign-in-status').textContent = 'Signed out';
43 document.getElementById('quickstart-account-details').textContent = 'null';
44 }
45 document.getElementById('quickstart-button').disabled = false;
46 });
47
48 document.getElementById('quickstart-button').addEventListener('click', startSignIn, false);
49}
50
51/**
52 * Start the auth flow and authorizes to Firebase.

Callers 1

credentials.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected