Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to inspect (using the Firebase console) the claims that have been set for a specific user?

Is there a way to inspect Users data from firebase console (https://console.firebase.google.com/)

Example:

UserRecord {
  uid: 'xxxxxxxxxxxxxxxxxxxxxx',
  email: undefined,
  emailVerified: false,
  displayName: undefined,
  photoURL: undefined,
  phoneNumber: '+xxxxxxxxxxxxxxx',
  disabled: false,
  metadata:
   UserMetadata {
     creationTime: 'Fri, 29 Mar 2019 16:58:32 GMT',
     lastSignInTime: 'Wed, 15 May 2019 09:27:35 GMT' },
  providerData:
   [ UserInfo {
       uid: '+xxxxxxxxxxxxxxx',
       displayName: undefined,
       email: undefined,
       photoURL: undefined,
       providerId: 'phone',
       phoneNumber: '+xxxxxxxxxxxxxxx' } ],
  passwordHash: undefined,
  passwordSalt: undefined,
  customClaims: { test: true },
  tokensValidAfterTime: undefined 
}
like image 628
Tomislav Hofman Avatar asked Sep 13 '25 12:09

Tomislav Hofman


1 Answers

No, at the time of writing, there is no way to inspect, from the Firebase console, the Custom Claims that have been set for a user.

One way to inspect the Claims, is to write a Cloud Function with the following code

// Lookup the user associated with the specified uid.
admin.auth().getUser(uid).then((userRecord) => {
  // The claims can be accessed on the user record.
  console.log(userRecord.customClaims);
});

See this documentation item: https://firebase.google.com/docs/auth/admin/custom-claims#set_and_validate_custom_user_claims_via_the_admin_sdk

like image 193
Renaud Tarnec Avatar answered Sep 15 '25 07:09

Renaud Tarnec