Namviek

Namviek

Sign In

Gmail Authentication

Using Firebase to integrate Gmail authentication

Firebase is a free platform and it has a lot of helpful services. One of these is Authentication, it provides a quick and easy setup guide for Gmail authentication.

This will guide you to create a Firebase project and integrate Gmail authentication service.

Create Firebase project

Go to Firebase Console to create your own project with any name you want. Then it will generate some configuration as follow, save it to packages/ui-app/libs/firebase.ts

const firebaseConfig = {
  apiKey: "-------",
  authDomain: "namviek-------.firebaseapp.com",
  projectId: "namviek------",
  storageBucket: "namviek-------.appspot.com",
  messagingSenderId: "9283918273987",
  appId: "1:109283098098:web:91jh23iuh123879kjh",
  measurementId: "G-89OIWOIEJR"
};

However, it would be better to hide these configuration in an environment variable.

NEXT_PUBLIC_FIREBASE_CLIENT_CONFIG={"apiKey":"-------","authDomain":"namviek-------.firebaseapp.com","projectId":"namviek------","storageBucket":"namviek-------.appspot.com","messagingSenderId":"9283918273987","appId":"1:109283098098:web:91jh23iuh123879kjh","measurementId":"G-89OIWOIEJR"}

Firebase Admin Configuration

Namviek's verify access token by itself and it use Firebase only for verifying Gmail account is correct or not. So you have to generate serviceAccount key for this process.

Go to Firebase Console again and redirect to Project settings > Service accounts. Choose your SDK and press Generate new private key button.

Generate service account

After the download successfully, open your .env file and add/update these variables

FIREBASE_PROJECT_ID=<project-id>
FIREBASE_CLIENT_EMAIL=<client-email>
FIREBASE_PRIVATE_KEY=<private-key>

Lastly, restart the backend.

Getting Started

Setup Guide

Integration

Backend deployment

Development Guide

Frontend deployment

Community