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

Function toggleSignIn

auth/anon.ts:32–48  ·  view source on GitHub ↗

* Handles the sign in button press.

()

Source from the content-addressed store, hash-verified

30 * Handles the sign in button press.
31 */
32function toggleSignIn() {
33 if (auth.currentUser) {
34 signOut(auth);
35 } else {
36 signInAnonymously(auth).catch(function (error) {
37 // Handle Errors here.
38 const errorCode = error.code;
39 const errorMessage = error.message;
40 if (errorCode === 'auth/operation-not-allowed') {
41 alert('You must enable Anonymous auth in the Firebase Console.');
42 } else {
43 console.error(error);
44 }
45 });
46 }
47 signInButton.disabled = true;
48}
49
50// Listening for auth state changes.
51onAuthStateChanged(auth, function (user) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected