Firebase Hosting: Preventing unauthorized access to URL

雨燕双飞 提交于 2019-11-28 04:24:57

问题


I am trying to secure some pages behind firebase auth -however every time I try open them - I seem to be able to browse to them. Even when I follow the documentation.

I can't seem to find anyway to restrict the page to be accessible only to authorized users.

Any idea how best to approach this?

Edit: Looks like its not supported directly without building a lot of custom code. It would be brilliant if they can support a simple htaccess file or similar. - Here is a link to post feature request https://firebase.google.com/support/contact/bugs-features/


回答1:


All static content (HTML, CSS, JS, and other files) published to Firebase Hosting is publicly accessible if you know the URL. There are no authentication controls you can easily configure to change this behavior.

If you need to protect content, you could set up some code via Cloud Functions that checks the user's authentication and serves the content based on its decision.



来源:https://stackoverflow.com/questions/47837517/firebase-hosting-preventing-unauthorized-access-to-url

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