Setup Firebase 🔥
Go to the Firebase Console:
Create a new project.
Go to
Firestore Database
and create a new database.Go to
Authentication
and enable theGoogle
,GitHub
andemail/password
sign-in methods. Go toAuthorized domains
and addlocalhost
and your production domain.Go to the
Project Settings
and scroll down toYour apps
and create a new web app. Copy the config values into your.env.local
file.Go to
Settings > Service Accounts
and generate a new private key. Save the JSON file and copy the values into your.env.local
file.
Your .env.local
file should look something like this:
# Firebase Admin (for firestore) - Get the values from the service account JSON file
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-........iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIIE.........Sw==\n-----END PRIVATE KEY-----\n
# Firebase (for client-side)
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaS.......Dym4tqfo
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=s...6.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=s...6
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=s...6.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=1...2
NEXT_PUBLIC_FIREBASE_APP_ID=1:10.........b295
Now you can sign-in with Google, or email/password!
Last updated Sat Aug 17 2024