I'm using firebase cloud functions with the admin sdk in order to perform some operations on the realtime database on behalf of the user.
For example, if the user wants to store a new parameter on the database, it will press a button on its android client which relies on a directly callable function (onCall). This callable function will save the parameter in the right location in the database.
Now, I understand the onCall function receives automatically some info about the user in the context parameter, such as the user id and the token, but I don't know if these parameters are used to control the effective identity of the user.
Since the function is running with the admin sdk in full privilege mode, I want to be sure that the user is who he claims to be. In a scenario in which one user steals the uid of another user, and calls the function with this uid but with its own Auth token, he will be detected?
Does the function check if the user id (uid) is compliant with the Auth token?
If yes, the only thing I have to do is to check if context.auth is different from null?