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);
}
You should have done searching by yourself first. Here you are,
For UPDATED UI
Follow the below steps to get it in new UI of Firebase Console:
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.
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'
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:
I hope this helps!
NOTE : Same for both old and new UI of the firebase.
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
I hope it helps you.
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. S witch to Realtime Database from the blue dropdown on the top and you will get the url watch this image
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 .
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
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
let connectedRef = Database.database(url: "your url")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.