Getting user info from request to Cloud Function in Firebase

旧街凉风 提交于 2020-05-13 05:14:02

问题


I'd like to be able to get user information for a Cloud Function that gets called in Firebase. I have something like this, which is being called after the user signs into the app:

exports.myFunction = functions.https.onRequest((req, res) => { ... }

And I need to get the uid of the signed-in user that made the request. Any advice or comments please?


回答1:


Information about the user that makes the request is not automatically passed along with HTTPS functions calls.

You can either pass the ID token along yourself and decode/verify it in your function, or you can use a callable HTTPS function, which passes the user information along automatically.



来源:https://stackoverflow.com/questions/52444812/getting-user-info-from-request-to-cloud-function-in-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!