简体   繁体   English

Phonegap的Firebase简单登录问题

[英]Firebase Simple Login Issue with Phonegap

I am trying to use "password" authentication with Firebase Simple Login in Phonegap but getting this error: 我试图在Phonegap中对Firebase简单登录使用“密码”身份验证,但出现此错误:

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. 另外,Firebase管理GUI中的“身份验证”设置如何。 How can we allow Phonegap based apps to access Firebase server? 我们如何允许基于Phonegap的应用程序访问Firebase服务器?

The error message states pretty clearly that you can't use popup authentication when accessing a page via file://. 错误消息非常清楚地表明,通过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/ . 因此,您不需要运行浏览器,而无需在浏览器中输入本地文件路径,而需要使用http://localhost/类的URL。

This isn't an issue with Firebase's security but instead a basic browser sandboxing feature. 这不是Firebase的安全性问题,而是基本的浏览器沙箱功能。

Getting a server is pretty straightforward. 获取服务器非常简单。 If you're using python, as noted, you can run python -m SimpleHTTPServer . 如前所述,如果您使用的是python,则可以运行python -m SimpleHTTPServer If node.js is more your ball of wax, there is a great, simple http-server lib for node as well. 如果node.js更适合您,那么node也有一个非常简单的http-server lib。 If you're on Mac, you already have one , and otherwise, you could try XAMPP . 如果您使用的是Mac,则已经有一个 ,否则,您可以尝试XAMPP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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