Search code examples
firebasefirebase-authenticationfirebase-cli

Is it possible to add custom claims through CLI?


Our Application will have a limited amount of admin users that I would like to manually add an admin custom claims to their account. As such I would like to be able to just manually add a custom claims directly through the firebase console or CLI locally on my machine. This action might occur once a year only or not at all for just one user. If it cannot be done through the CLI is there another way to do it on my machine locally?


Solution

  • There is no command in the CLI to add custom claims.

    The simplest way I've found to add custom claims is through a tiny node.js script, as shown here:

    admin.auth().setCustomUserClaims(uid, {admin: true})