Skip to content

Commit 0f95a92

Browse files
doc(Auth): guide for set custom user claims
1 parent dd33367 commit 0f95a92

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/guide/authentication.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ sign in, or sign in as the user on the server.
8989
user = auth.sign_in_with_custom_token(token)
9090
..
9191
92+
93+
set_custom_user_claims
94+
----------------------
95+
96+
You can add custom claims to existing user, or remove
97+
claims which was previously added to that account.
98+
99+
.. code-block:: python
100+
101+
# add claims
102+
auth.set_custom_user_claims(user['localId'], {'premium': True})
103+
104+
# remove claims
105+
auth.set_custom_user_claims(user['localId'], {'premium': None})
106+
..
107+
108+
.. note::
109+
1. You need admin credentials (Service Account Key) to add or
110+
remove custom claims.
111+
112+
2. The new custom claims will propagate to the user's ID token
113+
the next time a new token is issued.
114+
115+
92116
sign_in_anonymous
93117
-----------------
94118

0 commit comments

Comments
 (0)