Skip to content

setCustomUserClaims()

setCustomUserClaims(uid, customUserClaims): Promise<void>

Defined in: CloudFireAuth.ts:370

Sets additional developer claims on an existing user identified by the provided uid, typically used to define user roles and levels of access. These claims should propagate to all devices where the user is already signed in (after token expiration or when token refresh is forced) and the next time the user signs in. If a reserved OIDC claim name is used (sub, iat, iss, etc), an error is thrown. They are set on the authenticated user's ID token JWT.

See Defining user roles and access levels for code samples and detailed documentation.

Parameters

uid

string

The uid of the user to edit.

customUserClaims

The developer claims to set. If null is passed, existing custom claims are deleted. Passing a custom claims payload larger than 1000 bytes will throw an error. Custom claims are added to the user's ID token which is transmitted on every authenticated request. For profile non-access related user attributes, use database or other separate storage systems.

object | null

Returns

Promise<void>

A promise that resolves when the operation completes successfully.