Firebase:AngularFire 中的本地开发和测试 [英] Firebase: Local Development and testing in AngularFire
问题描述
我正在使用 Angularfire 制作网站.我正在尝试将基于 oauth
的登录与 google
集成以进行用户身份验证,但是当我尝试运行 index.html
文件并尝试登录时显示错误
I am using Angularfire to make a website. I am trying to integrate oauth
based sign in with google
for user authentication but when I try to run index.html
file and try to login following error is displayed
11:59:28.189 Error: There are no login transports available for the requested method.
Stack trace:
Mg@file:///G:/Project/root/js/firebase.js:142:1267
dh/<@file:///G:/Project/root/js/firebase.js:163:141
1 app.js:31:4
我在stackoverflow上搜索了这个,得到了这个答案 ,它说我需要为此设置一个服务器.
然后我查看了 firebase 文档,他们说
I searched on stackoverflow for this and got this answer , it says that I need to setup a server for this.
Then I looked at firebase docs and they said
出于安全原因,如果您使用的是基于网络的 OAuth 流程(Facebook、Twitter、Github 或 Google),只有您指定的域允许白名单为您的应用启动身份验证.这个不适用于电子邮件和密码、匿名或自定义身份验证方法.所有 Firebase 应用程序都有 localhost 和本地开发和测试默认启用 127.0.0.1.
For security reasons, if you're using a web-based OAuth flow (Facebook, Twitter, Github, or Google), only domains that you whitelist are allowed to initiate authentication for your app. This does not apply to Email & Password, Anonymous, or Custom authentication methods. All Firebase applications have localhost and 127.0.0.1 enabled by default for local development and testing.
在我将其托管在 firebase 上后,身份验证工作正常,但部署需要大量时间,有时甚至我无法访问互联网.
所以请建议我最简单的方式,以便我可以在本地主机上运行我的应用程序.
The authentication works fine after I host it on firebase but deploying takes a lot of time and also sometimes even I don't have access to internet.
So please suggest me easiest manner so I can run my app on localhost.
推荐答案
在本地运行 Firebase(或任何其他)网站的一种简单方法是使用 Firebase 工具,然后运行
An easy way to locally run a Firebase (or any other) web site is to use the Firebase tools and then run
firebase serve
请参阅此博文介绍本地服务器.
这篇关于Firebase:AngularFire 中的本地开发和测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!