问题标签 [firebase-authentication]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
904 浏览

firebase - 会话到期时是否有回调?

我想知道会话到期时是否会触发任何回调(我正在使用 Simplelogin with $authWithPassword())。我已经用谷歌搜索并偶然发现了这个:https ://groups.google.com/forum/#!topic/firebase-talk/btaE-hCVQdk

但我不明白 auth-Method 的回调如何监听“会话过期”,因为它只执行一次(当用户登录时)。或者它的回调实际上有一个事件监听器?`

我尝试通过使用选项参数来测试登录expires: ((new Date()).getTime() + 1000) / 1000(它说,它需要一个以秒为单位的时间戳而不是毫秒),但我没有得到结果。

任何帮助表示赞赏。

0 投票
2 回答
862 浏览

firebase - 在 Firebase 中设置用户自己的密钥

这个问题已经在这里问过了,但是由于 AngularFire 更新了他们的 API,提供的解决方案不再可用。

我正在做的是使用电子邮件/密码创建新用户帐户,将该用户存储在 Firebase 身份验证服务中,并将额外信息存储在数据库中。

但是,在身份验证中,用户的密钥为simplelogin:29,而在数据中,每个用户的哈希密钥为-JpwB9oUVkeT_XRdiX2V。我确实需要他们的钥匙是一样的。

下面是创建新用户的代码,使用 auth.$createUser 注册并在用户模型中存储额外信息。

它可以工作,但不是应该的方式,因为用户在身份验证和数据中的密钥仍然不同。

0 投票
0 回答
1435 浏览

facebook - Facebook 在使用 Firebase 登录时返回错误消息

我正在尝试通过以下方式使用 Firebase Facebook 登录:

将此添加到我的 HTML 中(以进行测试):

和firebase脚本:

<script src="https://cdn.firebase.com/js/client/2.2.5/firebase.js"></script>

这在我的模块中:

var app = angular.module('myApp' ['firebase']);

然后在我的控制器内部:

当我重新加载页面时,localhost:8000我从 Facebook 收到以下消息:

Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

我遵循了 Firebase 文档和这个 stackoverflow url:Facebook 应用程序:Firebase 简单登录 URL 错误,但我仍然迷路了。

在我的应用程序拥有的站点 URL 下http://localhost:8000/,我也尝试在域名下包含,localhost:8000但 Facebook 删除它说"No Top-Level Domains allowed"。这都在“基本”设置下。在“高级”下,我有以下内容Valid OAuth redirect URIs

https://auth.firebase.com/v2/<myFirebase>/auth/facebook/callback http://localhost:8080/ https://auth.firebase.com/auth/facebook/callback

我已经在 Firebase 中启用了 Facebook 连接。我错过了什么?

0 投票
1 回答
480 浏览

firebase - 从限制区域注销而不触发安全设置

我有一个部分需要登录和特定角色(“高于 19”)。每当我从中注销时,我都会得到

原因是我的安全设置:

我的注销功能:

$state 'home' 没有任何读取限制,看起来注销实际上发生在我被重定向到触发安全限制的 'home'-$state 之前。

我想我很难理解如何在不触发安全设置的情况下从受限站点注销的基本概念,谁能解释我如何正确地做到这一点?

0 投票
1 回答
261 浏览

java - 带有 OAuth 的 Firebase Java 提供程序

这是我的第一篇 SO 帖子,如有错误请见谅!我也是 Java 新手,我正在尝试使用 Java 中的 Firebase 来控制我的 Nest 恒温器。我收到了一个授权码,我用它换取了一个 accessToken。但是,我无法弄清楚如何使用 Firebase Java 库进行身份验证。方法是

但是,我无法弄清楚该provider论点应该是什么。我试过了google,,,,,,, ; Google_ _ 一切都无济于事。Nestnestcustomanonymous

我设置了处理程序,以便它根据调用的方法打印出成功消息或错误消息,但它不会打印出其中任何一个!

我什至不确定提供商是否是我没有得到回复的原因。

附件是代码和输出的片段。

这就是输出:


编辑:

我已将方法更改为:

现在我得到了当前的输出:

但是,onAuthenticated 和 onAuthenticationError 方法都没有打印...

0 投票
1 回答
970 浏览

android - 活动中的 FirebaseAuth 内存泄漏

我在我的应用程序中添加了很棒的 LeakCanary 库,很快我就开始收到各种报告,说明我在各种活动中使用的FirebaseAuth对象生成的泄漏。

现在我的问题是:它是由 Firebase 库本身产生的泄漏,还是我应该销毁 onDestroy 中的对象(例如将其设置为 null)?

这是 LeakCanary 的报告这里是堆转储

0 投票
2 回答
3097 浏览

firebase - firebase 安全权限不起作用

我有以下数据存储在我的firebase

并遵循安全规则:

我的授权要求如下。

  1. 管理员只能由现有管理员读取和添加。这行得通。
  2. 管理员可以读取所有用户,但不应写入用户数据。
  3. 用户可以读取和更新他自己的用户数据。

目前使用上述规则,我无法读取管理员和登录用户的用户数据。我收到以下错误消息。请提供您的帮助。谢谢。

错误:

错误:permission_denied:客户端无权访问所需数据。

0 投票
2 回答
948 浏览

android - 是否可以在 Web 和 Android 客户端中通过 Google 使用 Firebase 的内置身份验证?

按照Firebase 文档中关于配置 Web 客户端应用程序的说明,它说我需要在 Google Developers Console 中创建一个新的客户端应用程序。这可以。但是,我已经在这里为我的服务的 Android 客户端应用程序定义了一个客户端应用程序。每个都有自己的 Google 控制台客户端 ID,Firebase 只允许您在 Firebase 仪表板的登录和身份验证部分输入一个客户端 ID 和客户端密码。我是否遗漏了某些东西,或者使用单个 Firebase 应用程序无法同时支持 Web 和 Android 客户端应用程序?

0 投票
3 回答
2766 浏览

angularjs - Firebase 注销显示权限被拒绝错误。

因此,每当我从 Firebase 注销时,我都会被耦合

我知道这是因为登录会话已终止,我的某些对象无法再访问 firebase 数据。但是如何在注销之前断开这些对象?

对于我的一个 Ionic View 中的注销按钮,它只调用一个 firebase 服务:

So I destroy the $rootScope.currentUser there. I use the same getCurrentUser for profile page. So the Error did not show up this way. But when in other views, which I have another $firebaseArray, and also another Ref.on("child_added", function(snap) with the same $firebaseObject. When I view the profile page, then this page with at least 3 firebase connection, I got 3 permission_denied Errors when I logout (logout button is on user profile page).

My question is, how do I disconnect this firebase connection before I logout? Is there a way disconnect ALL the firebase connection - no matter AngularFire or regular Firebase? So I can logout without worry about which firebase connection I have no close yet? Also, since the Logout button is in Profile scope and the others connection is in a different scope, I have no idea how to close the connection which is not even in the profile scope...

0 投票
2 回答
3098 浏览

twitter - 如何在 React Native 中使用 Firebase Twitter 身份验证?

如何在 React Native 中使用 Firebase Twitter 身份验证?

我参考https://www.firebase.com/docs/web/guide/login/twitter.html尝试了以下两个代码

当我使用authWithOAuthRedirect时,发生了一个错误,例如

当我使用authWithOAuthPopup时,什么也没发生。

我该如何解决这个问题?还是不可能?