0

I would like to know the following

  1. How to get the Logged in User id inside firebase functions
  2. How to check a custom claim inside a firebase function

I know, we can check the auth inside callable function, but how about https functions

A help will be really appreciated

1 Answers1

1

For https functions, you'll have to explicitly pass user's ID Token in your HTTP request (e.g. in Authorization header). Then you can verify that ID token using Firebase Admin SDK which returns a DecodedIdToken object that contains user's custom claims.

Checkout the documentation on how to retrieve user's ID Token and for more information.

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
  • Isnt there a way to get something like - ****.getCurrentUser(). I mean we have the same inside the flutter firebase sdk – Dhrubajyoti May 05 '22 at 21:42
  • @Dhrubajyoti no, you'll have to manually verify the token. You can find any pre-made middleware node package if any – Dharmaraj May 05 '22 at 21:43