1.0.3 • Published 3 years ago
firebase-sign-in-with-ethereum v1.0.3
firebase-sign-in-with-ethereum
Asynchronously signs in using an Ethereum address.
Use the ethereum address in your wallet (MetaMask) to sign the credentials used to sign in with the Firebase Auth SDK.
Note: This strategy use the
signInWithEmailAndPassword
method of the Firebase Auth SDK.
Install the package
Install the firebase-sign-in-with-ethereum npm module:
npm i firebase firebase-sign-in-with-ethereum
Use in you project
- Call the
signInWithEthereum
method and indicate the auth instance of the Firebase SDK.
import { signInWithEthereum } from "firebase-sign-in-with-ethereum";
import { getAuth } from "firebase/auth";
const auth = getAuth();
signInWithEthereum(auth)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
// ..
});
- The next step is to grant to the read address permission from your Ethereum wallet.
- The next step is sign the message with your Ethereum wallet.
Changelog
Can be found in CHANGELOG