/auth
Search
K
Comment on page

updateUserMetadata( )

Developers are able to store key-value data directly on a user at the app-level and at the org-level. This function allows for updating the key-value store.

Usage

const { data } = await client.user.updateUserMetadata({
userID: 'user.1234',
metadata: {
'home_state': 'california',
}
});
console.log('User Metadata: ', data?.metadata);

Return Value

{
data?: {
id: string;
clientID: string;
organizationID?: string;
wallet: string;
nickname?: string;
roles: string[];
metadata?: ObjectMap;
createdAt: string;
updatedAt: string;
};
error: ErrorMessage | null;
headers: Object;
statusCode: number;
}

Configuration

userID

String that represents a user's ID.
const { data } = await client.user.updateUserMetadata({
userID: 'user.1234',
metadata: {
'home_state': 'california',
}
});
console.log('User Metadata: ', data?.metadata);

nickname (optional)

String that represents a nickname.
const { data } = await client.user.updateUserMetadata({
userID: 'user.1234',
nickname: "Michael Smith"
});
console.log('User Metadata: ', data?.metadata);

metadata (optional)

String that represents any additional data.
const { data } = await client.user.updateUserMetadata({
userID: 'user.1234',
metadata: {
'home_state': 'arizona',
}
});
console.log('User Metadata: ', data?.metadata);

organizationID (optional)

String that represents an organization's ID.
const { data } = await client.user.updateUserMetadata({
userID: 'user.1234',
organizationID: 'org.abc',
metadata: {
'home_state': 'california',
}
});
console.log('User Metadata: ', data?.metadata);