简体   繁体   中英

Is FireBase hosting dependent?

I created a very simple FireBase + Angular app with AngularFire, or rather, I copied the code from the examples. All it does, for now, is allow logging in and out via Google. The code is so simple I don't think there's even a need to post it here.

I tried it on different static files hosting solutions, and got somewhat weird results.

On Google Drive, Dropbox, and Github. Though the pages were served on all of them, no 404 error and no JS errors in the console, the login itself didn't work. What would happen is that the program would launch the login screen and log in the user, but then the angular "auth.user" object stayed null.

The same code exactly, when run on Visual Studio (just by "view file in browser") and also hosted on FireBase's own hosting solution, ran as expected, no problems. Logging in and logging out both worked.

I wondered how that could be, since this is a "no backend" app, or, more precisely, it has the same back-end, ie FireBase services.

What is happening here?

explanation on hosting on Google Drive explanation on hosting on Dropbox and Github

(comments on how to improve this question will be appriciated)

You have to liste the domains that will host your app in the settings of FireBase.

It is in the login and auth tab, the "Authorized Domains for OAuth Redirects" field.

You should put there the domains you want to use, like dropbox.com, etc...

Details here : https://www.firebase.com/docs/web/guide/user-auth.html#section-configuring

Your code works on your local Visual Studio because localhost and 127.0.0.1 are enabled by default.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM