How to write in db with firebase function not as admin

前端 未结 2 1327
猫巷女王i
猫巷女王i 2021-01-21 13:34

I am trying to write on firebase function some data to DB when some http triggers ,my issue I didn\'t find any examples how is it possible to do without admin permission because

2条回答
  •  [愿得一人]
    2021-01-21 13:50

    You're looking for event.data.ref. From the reference documentation:

    Returns a Reference to the Database location where the triggering write occurred. This Reference has the same end-user permissions as the client that did the write. So, if an unauthenticated client did the write, this Reference is unauthenticated. If the client that did the write is authenticated as a certain Firebase Auth user, this Reference is authenticated as that same user.

提交回复
热议问题