且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

firebase PHP:创建用户

更新时间:2023-12-01 15:52:22

我不确定我完全理解你的问题。如果您尝试以给定用户身份验证客户端,则需要生成身份验证令牌,将其放在页面中,然后让客户端使用该令牌调用auth()。请参阅这里的文档:

https://www.firebase.com/docs/security/custom-login.html



如果您只是想将一些数据写入Firebase位于PHP的/ users位置,您可以使用REST API执行此操作:

https://www.firebase.com/docs/rest-api.html


I have data that I need to save into firebase from a user. My Firebase schema is like..

{
   users: {
      1: {
         data..

Is it possible to create a new Firebase user in PHP so that I can use the generated user_id to save the data?

I'm not sure I fully understand your questions. If you're trying to authenticate a client as a given user, you need to generate an authentication token, place it in the page, and have the client call auth() with that token. See the docs here:

https://www.firebase.com/docs/security/custom-login.html

If you're merely trying to write some data into Firebase at the /users location from PHP, you can do so with the REST API:

https://www.firebase.com/docs/rest-api.html