Follow these steps to create a .env
file:
cp .env.example .env
in your project root..env
file and fill in the required information.Retrieve Google API credentials for your app:
.env
file.Set up Firebase credentials for your project:
.env
file..env
file.cp firebase.ts.example firebase.ts
in your project root.const firebaseConfig = ${...}
and paste that in your firebase.ts file.Uncomment the Firebase Admin initialization in the firebase-admin.ts
file.
Open firebase-admin.ts
then push ctrl + a
then ctrl + /
then ctrl + s
Uncomment the FirebaseAuthProvider component wrapper in the layout.tsx
file.
Open layout.tsx
then uncomment line 28 and 31.
Turn this: {/* <FirebaseAuthProvider> */}
<Header />
{children}
{/* </FirebaseAuthProvider> */}
To this: <FirebaseAuthProvider>
<Header />
{children}
</FirebaseAuthProvider>
Save the changes and restart the development server to test the login functionality.
For more details on setting up environment variables, refer to the Next.js Environment Variables documentation.