I am working on an assistant app for which I am writing a cloud function which must retrieve the current user data from Firebase database by using the user id. I am using firebase admin and I referred the docs for firebase admin where they've mentioned the way of retrieving user data by using user id but they haven't mentioned how to get the current user id. How do I get the currently signed in user id?
In order to get currently signed user id, you need to enable Account Linking
in your AoG app.
In your AoG settings, enable Account linking
with authorization code as grant type. Fill your client information and choose scopes.
Now when a user uses your app, it will ask for sign in, and on your AoG backend, you will be able to get authorization code
.
Now using that authorization code you can retrieve the required user id and use that for your firebase admin.
You can find more info for Account linking here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With