I have question regarding the logic for implementing a profile image uploader and storing the image url in a database under the user uploading the image using react-native and firebase authentication, cloud functions, database and storage services.

An example of the way the imageUrl would be stored

{ “users”: { “7ad9310fsasghsa72”: { imageUrl: ‘imageHoster.com’ }, “4k2dH5lifs35kfsp0”: { imageUrl: ‘imageHoster.com’ }, } }

The question is, is the logic below a correct utilisation of firebase services in relation to implementing this feature or is there a better way?

User uploads image on mobile device through react-native

Image gets sent to a firebase cloud function, for validating it, reducing it to 150x150

Image gets stored in google cloud storage

URL returned from the stored image is stored in firebase database under the user who is uploading the image

Also using this firebase implementation what is the way for authenticating the user making the request inside of the cloud function so that I’m able to store the url of the image returned from storage service under that user in the database?

Thanks