简体   繁体   English

我如何使用 firebase auth 在 nodejs 的服务器端验证用户电话号码

[英]How can i authenticate user phone number on server side in nodejs with firebase auth

Is it possible to authenticate a user's phone number or email in nodejs environment instead of using firebase client sdk's for Android and iOS.是否可以在 nodejs 环境中验证用户的电话号码或电子邮件,而不是使用适用于 Android 和 iOS 的 Firebase 客户端 sdk。 Use case here is client sends phone number and otp to server and server authenticates it and creates a user of number/email if verified.这里的用例是客户端将电话号码和 otp 发送到服务器,服务器对其进行身份验证并在验证后创建号码/电子邮件用户。

In client sdk there is signInWithPhoneNumber method which is used to authenticate mobile numbers, I want to know if it is possible to move this process to server side so client doesn't have to handle sdk's在客户端 sdk 中有用于验证手机号码的signInWithPhoneNumber方法,我想知道是否可以将此过程移动到服务器端,以便客户端不必处理 sdk

What would be the ideal way to proceed here?在这里进行的理想方式是什么?

I'm not sure if I understand you.我不确定我是否理解你。 Maybe, you should write your own rules in security rules.也许,您应该在安全规则中编写自己的规则。 Then you don't need to mess with nodejs/serverside solutions.那么你就不需要弄乱 nodejs/服务器端解决方案了。

The second thing, nodejs is JavaScript so, if you can install packages on the backend side like express, etc. You suppose to add firebase packages as well.第二件事,nodejs 是 JavaScript,所以,如果您可以在后端安装包,例如 express 等。您还假设添加 firebase 包。 So in theory, you should install it and use it on the server-side in the same way as in the frontend.所以理论上,你应该像在前端一样在服务器端安装和使用它。 Then you can just add some more validation on the server, writing your own regexp to check if the number is correct.然后您可以在服务器上添加更多验证,编写您自己的正则表达式来检查数字是否正确。

I never use it but theoretically, it is possible.我从不使用它,但从理论上讲,这是可能的。

暂无
暂无

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

相关问题 如何在 firebase.auth (js, ts) 中更新用户电话号码 - how to update user phone number in firebase.auth (js, ts) 如何使用从 firebase 存储的 Auth uid 并更新 Auth 用户信息,例如更改密码、email 和电话号码? - How to use Auth uid that store from firebase and update Auth user information such as change password, email and phone number? 如何在服务器端使用 SvelteKit 获取 Auth0 中的用户详细信息 - How can I get the user details in Auth0 using SvelteKit on the server side Firebase 身份验证如何仅使用客户端代码安全地对用户进行身份验证? - How can Firebase Authentication securely authenticate a user with only client-side code? 我可以使用此代码创建 firebase 用户,但如何在默认 firebase 用户表中添加显示名称、电话号码和其他信息? 谢谢 - I can create firebase user using this code, but how can I add display Name, phone Number and other information in default firebase user table? Thanks FIREBASE phoneAuth (LinkWithPhoneNumber)。 稍后如何在 Firebase Web 中更改用户的关联电话号码。 ( nodejs, Create-react-app )? - FIREBASE phoneAuth ( LinkWithPhoneNumber ) . How to change a user's linked phone number later in Firebase Web. ( nodejs, Create-react-app )? 如何在 Firebase Auth 中添加或更新电话号码 - How to add or update phone_number in Firebase Auth 如何在启用电话身份验证的情况下导出firebase用户帐户 - How to export firebase user account with phone Auth enabled 如何查看 JavaScript 中有效用户的电话号码? - How can I check a valid user's phone number in JavaScript? 在服务器端使用护照js本地用户身份验证后,如何在客户端使用Cookie来显示用户信息? - How do i use cookies on the client side to display user information after passport js local user auth on the server side?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM