How to customize domain name of firebase database, auth and storage? - firebase

I know that I can customize domain name for firebase hosting.
But how can I customize the firebase database, auth and storage domain name?
eg.
authDomain: example.firebaseapp.com => auth.example.com
databaseURL: example.firebaseio.com => db.example.com
storageBucket: example.appspot.com => storage.example.com
I tried to cname the domain (eg cname auth.example.com to example.firebaseapp.com)
but this cause the https://auth.example.com shows the certificate error.
can I resolve that?

Firebase doesn't offer the ability to whitelabel our services under your own domain.
You could choose to proxy all traffic through Hosting + Cloud Functions, but that would be a significant amount of additional work.
What is the need to offer your own custom domain on these services?

Did you also change the firebase script snippet in your code?
<script src="https://www.gstatic.com/firebasejs/4.4.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "yourkey",
authDomain: "auth.example.com",
databaseURL: "https://db.example.com",
projectId: "yourid",
storageBucket: "storage.example.com",
messagingSenderId: "id"
};
firebase.initializeApp(config);
</script>

Related

How to change default bucket in firebase storage [duplicate]

I have 1 storage buckets in Google cloud storage. Firebase create a new bucket and it is default in firebase console. I want to change the default bucket and delete the bucket created by firebase. And how can I find for config settings for my bucket in google cloud storage.
This is for default bucket :
var config = {
apiKey: "xx",
authDomain: "xx.firebaseapp.com",
databaseURL: "https://xx.firebaseio.com",
projectId: "xx",
storageBucket: "xx",
messagingSenderId: "xx"
};
firebase.initializeApp(config);
If you go to your Storage browser in the Cloud console, you will see a list of the storage buckets for your project.
Copy the name of the bucket you want to use and put it in the storageBucket property of the configuration.

How can I initialize the Firebase Admin SDK in spring-boot application using kotlin

I would like to get data from Firebase. I found some tutorials, but all is using Google Credential ServiceAccount to initialize firebase app. this's is tutorial that i found :
https://medium.com/techwasti/spring-boot-firebase-crud-b0afab27b26e , and else tutorial i found, almost like that too, is using ServiceAccount.
But the problem is i cannot get the ServiceAccount from this firebase because it's from third party. that's mean the owner of firebase don't want to give ServiceAccount.json to me, but they give me firebase config to me, like this :
const firebaseConfig = {
apiKey: "apkey",
authDomain: authdomain",
databaseURL: "databaseurl",
projectId: "projectid",
storageBucket: "storragebucket",
messagingSenderId: "messagesenderid",
appId: "appid",
measurementId: "measurementid"
};
So, how can i initialize this firebase using kotlin in my java springboot aplication?
i had try to find the solution, but not found anything,
I would be glad for any help.
If you want to initialize the Firebase Admin SDK, you will need a service account. There are no alternatives for this.
The config for the front end web app that you're showing here will not work at all. That config is only used for frontend apps that are acting as clients on behalf of the end user.

Create new database for development

I am about to release my first app using firebase RDB and once the app goes live I would still like to have access to a database that I can mess with for testing purposes.
Should I create a new database instance and then just modify the config object?
let config = {
apiKey: "apiKey",
authDomain: "newDatabase.firebaseapp.com",
databaseURL: "https://newDatabase.firebaseio.com",
projectId: "newDatabase",
storageBucket: "newDatabase",
messagingSenderId: "123456789"
}
Would this the right way to create a development database?
Copying from the comments above. The question is similar to this
The solution is to have multiple projects as dev, staging and production environments. Official post by Google shows how to achieve this.

How i version firebase code without credentials?

When you sign up to firebase they tell you to place this snippet in your code:
// Initialize Firebase
var config = {
apiKey: "your api key",
authDomain: "domain",
databaseURL: "database url",
storageBucket: "storage bucket",
messagingSenderId: "messaging sender id"
};
firebase.initializeApp(config);
Turns out i want to version it publicly on Github. Is there a way i can use some kind of environment variable or should i just don't version a credentials.js script.
All the information in that snippet is meant to be publicly shared with the users of your web app.
These are not secrets or credentials, but they're identifiers that allow the app code to find the Firebase project on Google's servers.
That said: many teams do not want to check it in to version control system, but instead force each developer to use their own Firebase project for development/testing.

Why don't I see the Firebase Web App API key?

Another app to add click > web click > Add a web app Firebase.
My situation
<script src="https://www.gstatic.com/firebasejs/3.4.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "",
authDomain: "********.firebaseapp.com",
databaseURL: "https://**********.firebaseio.com",
storageBucket: "********.appspot.com",
messagingSenderId: "*********"
};
firebase.initializeApp(config);
</script>
Go to Firebase Console. Select your app then you have your separated platform (ios, android) if ever you created two platforms already, if not, Click the additional settings from the upper right of the app, then click Manage. see image below:

Resources