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

*爱你&永不变心* 提交于 2019-12-30 10:14:10

问题


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?


回答1:


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?




回答2:


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>


来源:https://stackoverflow.com/questions/46484106/how-to-customize-domain-name-of-firebase-database-auth-and-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!