This project contains a simple authentication demo for the Firebase by a Web3 wallet. It uses the Authenticate with Moralis Auth extension for the Firebase.
Required Google Cloud services:
- Firebase Hosting
- Firebase Authentication
- Firebase Cloud Functions (only in the Blaze plan, check the pricing).
- Secret Manager (check the pricing)
- Clone this repo.
- Install Firebase CLI globally:
npm install -g firebase-tools
- Login to your account:
- Get list of your projects:
firebase projects:list. If this list is empty you should add a new project. You can do it by the Firebase Console.
- Set your project ID:
firebase use <PROJECT_ID>
- Generate a certificate for the Service Account. You will need it in the next step.
- Convert the certificate to extension variables by this online converter. You will use these variables in the next step.
- Install the Authenticate with Moralis Web3 extension:
firebase ext:install moralis/moralis-auth.
hosting/.envand set all variables.
- Build the functions project:
npm run build
- Build the hosting project:
npm run build
- Install Java on your computer. Functions Emulator requires Java.
- Run emulators:
http://localhost:5555/in your browser.
- If you have any problem with the CORS on the production, probably you should allow unauthenticated HTTP function invocation. To allow unauthenticated invocation you must specify this at or after deployment. Here you can read more about it.
Updated 10 days ago
Did this page help you?