How to write in db with firebase function not as admin

前端 未结 2 1328
猫巷女王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.

    0 讨论(0)
  • 2021-01-21 13:59

    It should be noted that user-scoped references are no longer available as shown here since version 1.0 of the functions SDK.

    0 讨论(0)
提交回复
热议问题