How to extract additional fields from a Firebase user token in "UserInfo"

I use a custom token method for authentication in firebase. From the server, I get a JWToken that has the following data in addition to other token fields:

{ "uid" : "user_uid", "user_role": "admin" }

In Firebase 2.x:

We used to get token fields as -

authData.getAuth().get("user_role").toString();

But in the new Firebase SDK:

How to get data (value "user_role") from the token.

NOTE. I tried using UserInfo to get the value "user_role", but there is no way / way to get such custom fields.

+4
source share
1 answer

Firebase .

, JWT , . jwt-decode . auth.

Realtime node , . node, , , .

+3

All Articles