# User Management

## How to get user data and use it across the application?

* [ ] [Save user data to the global variable](/developer-documentation/developer-documentation-for-the-construct-3-plugin/user-onboarding-and-authorization.md#getting-user-data-from-expressions) to make it usable across the application
* [ ] Use it in the components that need it

<figure><img src="/files/nFArP458AVSwI6jq1O21" alt=""><figcaption></figcaption></figure>

## How to update the username?

* [ ] Get a username from the input
* [ ] [Use the **Update Username**](#updating-username) action to change it
* [ ] Save the updated username in the user data global variable

<figure><img src="/files/J5dA7CEFXS0jwBmHomiU" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/IXDj6xXc6sW0EsymMGNB" alt="" width="375"><figcaption></figcaption></figure>

## How to update the user avatar?&#x20;

1. Get an avatar link from the input
2. [Use the Update Avatar action](#update-avatar) to change it
3. Save the updated avatar in the user data global variable

## Updating username&#x20;

The **Update Username** action is used to update the username for the logged-in user. If a new username is provided, it updates the user's profile with the new name; otherwise, it removes the username field. It sends a `PATCH` request to update the user's personal details using the `x-account-userid` and `Authorization` headers, which contain the user's ID and access token.

Once the username is successfully updated, the **On Username Updated** condition is triggered. The new username can be retrieved by calling the **Get Username** expression from the plugin.

## Update avatar

The **Update Avatar** is used to update the avatar for the logged-in user. If a new avatar URL is provided, it updates the user's profile with the new avatar; otherwise, it removes the avatar field. It sends a `PATCH` request to update the user's personal details using the `x-account-userid` and `Authorization` headers, which contain the user's ID and access token.

Upon successful avatar update, the **On Avatar Updated** condition is triggered. The new avatar URL can be retrieved by calling the **Get Avatar** expression from the plugin.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.metaproprotocol.com/developer-documentation/developer-documentation-for-the-construct-3-plugin/user-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
