如果我只知道 firebase 中的 UID,我可以登录用户的帐户吗 [英] can i login into a user's account if I just know UID in firebase

查看:22
本文介绍了如果我只知道 firebase 中的 UID,我可以登录用户的帐户吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮,我知道在 firebase 控制台的身份验证页面上创建用户后由 firebase 生成的用户唯一 UID,现在单击按钮后我想登录该用户,这可能吗?如果是,如何?我不想使用电子邮件和密码,我只想使用 UID 登录.

i have a button and i know a user's unique UID generated by firebase after a user is created on the firebase console's authentication page, now upon clicking the button i want to login that user, is that possible? if yes how? i don't want to use email and password, i want to login with just the UID.

我尝试创建自定义令牌,如下所示 无法解析 FirebaseOptions 中的 setCredentials.Builder().setCredentials(...)

I have tried creating custom token as shown here Cannot Resolve setCredentials in FirebaseOptions.Builder().setCredentials(...)

在我的应用程序中,我使用了人脸识别 API,因此用户可以通过两种方式登录:1)手动输入电子邮件,密码并单击登录.2)在登录页面中有一个按钮可以用面部登录,点击它会扫描面部并返回用户的UID(如果存在),现在我想登录该用户.

In my application i'm using a face recognition api, so the user can login by two ways: 1)manually by entering email, password and clicking sign in. 2)in the sign in page there is a button to sign in with face, clicking on which it scans the face and returns the UID of the user if exists, now i want to signin that user.

请帮忙.

推荐答案

您尝试做的事情是不可能的.基于客户端的身份验证要求您提供登录凭据,而不仅仅是 uid.如果任何使用应用程序的人只知道 uid 就可以登录,那将是一个巨大的安全漏洞.

What you're trying to do is not possible. Client-based authentication requires that you provide credentials for the login, not just a uid. It would be a huge security hole if anyone using an app could log in just knowing a uid.

如果您想在不登录的情况下代表用户执行某些操作,则应在您使用 Firebase Admin SDK 控制的安全后端上执行此操作.

If you want to do something on behalf of a user without logging in, you should do that on a secure backend you control using the Firebase Admin SDK.

这篇关于如果我只知道 firebase 中的 UID,我可以登录用户的帐户吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆