Skip to content Skip to sidebar Skip to footer

How To Retrive Additional Fields From Firebase Custom Token Into "userinfo"

I am using custom token method to authenticate in firebase. From server, I am getting JWToken which has following data in addition to other token fields: { 'uid' : 'user_uid', 'us

Solution 1:

the additional claims are accessible in the Firebase security Rules for the Realtime Database and Storage.

On the client side, since the JWT claims are just encoded into the token, you can decode the token and see the claims. You can use jwt-decode library to do this on the browser. After decoding, you will be able to see all the custom auth claims.

You can also store the claims in the Realtime database itself under the individual users' node and just read it from there when needed. You can then set a rule for that node such that only the logged in user can read their own claims.

Post a Comment for "How To Retrive Additional Fields From Firebase Custom Token Into "userinfo""