[英]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.