Untitled

 avatar
unknown
plain_text
3 years ago
1.2 kB
4
Indexable
 const login = () => {
    auth()
      .signInAnonymously()
      .then(() => {
        alert('User signed in anonymously');
      })
      .catch(error => {
        if (error.code === 'auth/operation-not-allowed') {
          alert('Enable anonymous in your firebase console.');
        }

        alert(error);
      });
  };
  const createAccount = () => {
    auth()
      .createUserWithEmailAndPassword(
        'jane.doe@example.com',
        'SuperSecretPassword!',
      )
      .then(() => {
        console.log('User account created & signed in!');
      })
      .catch(error => {
        if (error.code === 'auth/email-already-in-use') {
          console.log('That email address is already in use!');
        }

        if (error.code === 'auth/invalid-email') {
          console.log('That email address is invalid!');
        }

        console.error(error);
      });
  };

  const signinWithEP = () => {
    auth()
      .signInWithEmailAndPassword(
        'jane.doe@example.com',
        'SuperSecretPassword!',
      )
      .then(() => {
        console.log('signed in!');
      })
      .catch(error => {
        console.error(error);
      });
  };
Editor is loading...