简体   繁体   中英

Firebase Simple Login Issue with Phonegap

I am trying to use "password" authentication with Firebase Simple Login in Phonegap but getting this error:

Web Console(857): FirebaseSimpleLogin(): Due to browser security restrictions,
loading applications via `file://*` URLs will prevent popup-based authentication
providers from working properly. When testing locally, you'll need to run a
barebones webserver on your machine rather than loading your test files via
`file://*`. The easiest way to run a barebones server on your local machine is
to `cd` to the root directory of your code and run `python -m SimpleHTTPServer`,
which will allow you to access your content via `http://127.0.0.1:8000/*`. at
file:///android_asset/www/js/firebase-simple-login.js:74

How can we solve this problem? Also what about the Auth settings in Firebase admin GUI. How can we allow Phonegap based apps to access Firebase server?

The error message states pretty clearly that you can't use popup authentication when accessing a page via file://. So instead of entering a local file path into the browser, you need to run an http server, and use a URL like http://localhost/ .

This isn't an issue with Firebase's security but instead a basic browser sandboxing feature.

Getting a server is pretty straightforward. If you're using python, as noted, you can run python -m SimpleHTTPServer . If node.js is more your ball of wax, there is a great, simple http-server lib for node as well. If you're on Mac, you already have one , and otherwise, you could try XAMPP .

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