62

In the third last line of the below code, how can I find the firebase URL. I am not able to find it. Can anyone provide me the best link on how to setup firebase facebook login with android.

public void saveUser() {
    //Add YOUR Firebase Reference URL instead of the following URL
    Firebase myFirebaseRef = new Firebase("https://androidbashfirebase.firebaseio.com/"); //<---- How to find this
    myFirebaseRef = myFirebaseRef.child("users").child(getId());
    myFirebaseRef.setValue(this);
}
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Saif ali Karedia
  • 860
  • 1
  • 8
  • 15

12 Answers12

49

For Firestore I tried this to find get the databaseUrl and it works for me:

Go to Cloud Firestore tab and take the id as circled in the image.

enter image description here

Then the databaseURL is https://football-f559a.firebaseio.com

Tested this with Python and Firebase Admin sdk

import firebase_admin
from firebase_admin import credentials, firestore

cred = credentials.Certificate("./firebase-admin.json")
firebase_admin.initialize_app(cred, {
    'databaseURL': 'https://football-f559a.firebaseio.com'
})

db = firestore.client()

for k in db.collection("countries").get():
    print(k.id, k.to_dict())

Output:

A {'name': 'aaaaa'}
C {'name': 'C2'}

UPDATE:

Apparently I can use any databaseURL and it still works:

'databaseURL': 'https://xxxxx.firebaseio.com'
A.W.
  • 2,858
  • 10
  • 57
  • 90
  • 6
    That's because if you look in the sample snippet provided by firestore, databaseURL is no longer required for authentication – GraSim Apr 02 '21 at 16:03
40

You should have done searching by yourself first. Here you are,

  1. Open Firebase Console

enter image description here

  1. Select your app, and go to database, marked is the url you need.

enter image description here

For UPDATED UI

Follow the below steps to get it in new UI of Firebase Console:

  1. Go to Database section
  2. Tap Cloud Firebase (marked 1 in picture) and select Realtime Database
  3. Marked 2 is the URL

enter image description here

Waqas Ahmed Ansari
  • 1,683
  • 15
  • 30
39

In the New UI (Nov-2019)

You need to select project settings in the Left Corner.

enter image description here

Then Scroll Down to Apps Section

Select Config, Then you can get all the information.

enter image description here

BadPiggie
  • 5,471
  • 1
  • 14
  • 28
  • 2
    thank you, they keep changing it - I was a bit lost not having done this for almost 2 years – Seth Jun 15 '20 at 03:29
  • 5
    I can find the "databaseURL" for one of my projects here, but I cannot find it for a different firebase project. Is there some reason it'd not be displayed here? – Aaron N. Brock Aug 01 '21 at 18:35
12

When you create you Firebase database, it will be created with a unique URL ending in firebaseio.com. The URL of the database follows the format:

https://<PROJECT_ID>.firebaseio.com/

What you want to do is go to the Database tab, switch from Cloud Firestore (Beta) to Realtime Database using the select button. You will be able to see your DB URL as shown in the following:

enter image description here

I hope this helps!

elmiomar
  • 1,747
  • 2
  • 17
  • 27
9

NOTE: Same for both old and new UI of the firebase.

  1. Go to Authentication Tab and click on WEB SETUP button on the right upper side of the screen. enter image description here

  2. Now you will see a dialog box opened, you can see a lot of information fields in it and you will also be able to see a field databaseUrl, this is your required field. enter image description here

Varun Sukheja
  • 6,170
  • 5
  • 51
  • 93
9

For folks who stumble upon this issue in 2021: Google no longer seems to requires "databaseURL" for authentication. See Firestore SDK config file snapshot below enter image description here

That said, for authentication, you can use any of the following: projectId, storageBucket, serviceAccountID etc.

Documentation : https://firebase.google.com/docs/reference/admin/python/firebase_admin

Sbhambry
  • 494
  • 2
  • 8
  • 20
  • 1
    For anyone in 2023 ending up here while trying to get pyrebase to work in python. I found you have to have a databaseURL and storageBucket key value pairs when setting up your config object. But I am not using either so passed None as the value and could authenticate fine. – its_broke_again May 16 '23 at 16:42
7

Update: UI of firebase has been changed so follow below steps

enter image description here


enter image description here


enter image description here

Sabunkar Tejas Sahailesh
  • 4,436
  • 2
  • 28
  • 32
5

If you haven't created Firebase account already, Just Create it first. Head over to console and add a new App over there if not added. If you already got an app just click on it and go to dashboard.

In Dashboard click on Database and you will see the Firebase Reference URL over there. Refer to below Screenshot

Firebase Reference URL

I hope it helps you.

Kshitij Jain
  • 2,103
  • 2
  • 13
  • 18
2

As Neeraj Chand said: Now there are two kinds of databases on firebase - firestore and Realtime Database. If you are on firestore mode (default) then u might not find the url to db directly. Switch to Realtime Database from the blue dropdown on the top and you will get the url watch this image

Igris Dankey
  • 383
  • 2
  • 6
1

now 2021 ui like this

Just click the Realtime Database link on the left side and create a firebase database. After successful creation, you will get a link for your database ending with firebaseio.com. Make use of it. This is 2021 update

Itchydon
  • 2,572
  • 6
  • 19
  • 33
btm me
  • 368
  • 3
  • 11
1

If your firebase location is other than us-central1, the url must be more slightly changed, such as https://androidbashfirebase.asia-northeast1.firebasedatabase.app. See examples on Select locations for your project.

kawauso
  • 355
  • 2
  • 5
-6
let connectedRef = Database.database(url: "your url")
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Lorenzo
  • 1
  • 2