AngularM
AngularM

Reputation: 16628

Where can I find my Firebase apiKey and authDomain

Where can I find my Firebase apiKey and authDomain?

I'm setting up my environment to connect to my database.

export const environment = {
  production: false,
  firebase: {
    apiKey: '...',
    authDomain: '...',
    databaseURL: 'https://******-project.firebaseio.com',
    projectId: '*******-project',
  }
};

But can't find the apiKey and authDomain inside the firebase console.

Upvotes: 48

Views: 72606

Answers (7)

A. Ahmad
A. Ahmad

Reputation: 536

  1. Go to the firebase console and select your project.
  2. Select the Authentication.
  3. Go to the Setting tab.
  4. Inside Authorized domains you can find your authDomain.

Check the below picture for more details. Your Project > Authentication > Settings > Authorized domains

Upvotes: 2

ALIREAZ
ALIREAZ

Reputation: 1

<script src="https://www.gstatic.com/firebasejs/8.8.0/firebase-app.js"></script>
<script>
        // Your web app's Firebase configuration
        // For Firebase JS SDK v7.20.0 and later, measurementId is optional
            var firebaseConfig = {
            apiKey: "XXX-XXXX-XXXX",
            authDomain: "xyz.firebaseapp.com", // as follows your app uri xyz.firebaseapp.com/__/auth/handler
            projectId: "xyz",
            storageBucket: "xyz.appspot.com",
            messagingSenderId: "XXXXXXXX",
            appId: "1:XXX:web:XXX",
            measurementId: "G-XXX"
            }; 
        // Initialize Firebase
        firebase.initializeApp(firebaseConfig);
        firebase.analytics();
    </script>
<script src="https://www.gstatic.com/firebasejs/8.8.0/firebase-analytics.js"></script>

Upvotes: 0

PunithMatli
PunithMatli

Reputation: 31

You can find it in one of the following ways:

  1. Click Authentication and at the upper right side in that page, click Web setup.
  2. Otherwise Go to your project overview, click on '+ Add app' button, which you can find next to your project name. After that, select 'web app' or < / > button. Give your web app name and click continue. Then a pop-up appears with your app details.

Upvotes: 1

Jim
Jim

Reputation: 2322

If you don't want to create a web app, and the other non-create solution above didnt work for you like it didnt work for me, here's a cheatsheet:

firebaseConfig = {
  apiKey: (this one's easy, it's in the 'General' section in your project settings page, aka the Gear icon button),
  authDomain: "{project_id}.firebaseapp.com", (without brackets)
  databaseURL: "https://{project_id}.firebaseio.com",
  projectId: (again, found in 'General' section in Project Settings),
  storageBucket: "{project_id}.appspot.com",
  messagingSenderId: (found in 'Cloud Messaging' section in Project Settings)

Upvotes: 43

Sphoorthy Nutulapati
Sphoorthy Nutulapati

Reputation: 593

The easiest way to find these properties without having to create a new app is to go to your project in the Firebase Console.

Next, click the gear icon beside the Project Overview in the sidebar to the left at the top and click on project settings.

Under the general tab, which is what should open up by default, scroll down a bit til you get to the your apps section. Inside that area, you will find the Firebase SDK Snippet heading.

Under that, you'll have three checkboxes. Go for the Config checkbox, and you will see a JS object declaration, with all the information you'd need about your app to connect to the database.

Your Firebase SDK Config

enter image description here

Upvotes: 46

Dodong Advices
Dodong Advices

Reputation: 89

Go to console then open your project
Click Authentication Look at the upper right side then click the Web setup
Then copy&paste IMG

Upvotes: 2

Frank van Puffelen
Frank van Puffelen

Reputation: 598740

The easiest way to find these is to:

  1. go to the Project overview page in the Firebase console
  2. click the + in the top bar
  3. click </> button to add a web app

You'll get a pop up with the values you need.

enter image description here

Upvotes: 66

Related Questions