# Atualização de token

**Why Does the Token Expire?**

When a user leaves the report screen open for more than 1 hour without interacting with the report, the authentication token expires, and you may see a "ClientError\_TokenExpired" error message after that time.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-1765fe105bddf3b75888e5782d4a27b19dfe31d2%2Fimage%20(370).png?alt=media" alt=""><figcaption></figcaption></figure>

If the user sees this error message, the solution is simple: just refresh the page, and the report will be loaded again.

The Power BI Embedded token expires to maintain security and control who can access reports. Since it allows temporary access, expiration prevents someone from continuing to use the system if the token is shared or exposed accidentally. Additionally, this measure ensures that if there are changes in permissions or a need to block access, it happens quickly without leaving gaps.

By default, the Power BI Embedded API token is valid for 1 hour. This time is considered sufficient for a normal usage session but short enough to avoid risks. If it is necessary to continue using the system after this period, a new token needs to be generated by the application. This keeps access always updated and secure.

### A**utomatic Token Update**

Power Embedded has a feature that automatically updates access tokens when you interact with the report, such as applying a filter, switching a report page, or clicking on a visual.

However, if the user remains inactive for more than 1 hour without interacting with the report (e.g., a report on a TV), the token may expire, show an expired token error message, and you will need to update the page.

To solve this problem, Power Embedded implemented timed token updates.

### **Timed Token Update**

To force timed updates of the Power Embedded authentication token, access the **Settings** page.

On this screen, there is the option to **"Update Token every**" x minutes. This option will cause Power Embedded to force token updates at the selected minute interval.

If the user leaves the screen open without interacting with the report, the token may expire. Configuring this option allows the token to be updated periodically, preventing disconnections due to expiration, even if the report is idle.

#### **How to Configure Timed Token Updates**

1. Access the **Admin Porta**l.
2. Navigate to the **Settings** page.
3. Find the "**Update Token every**" option.
4. Define the **desired** time interval and click **Save**.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-c39fcf1fe74af0fec595515d8e341b5cdbaabe3b%2Fimage%20(148).png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**Note:** If you have configured the capability to turn off automatically based on X minutes of inactivity, this configuration will prevent the capability from being turned off.\
An alternative is to configure that only some users can turn on or keep the capability on.
{% endhint %}


---

# 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.powerembedded.com/portal-de-administracao/configuracoes/organizacao/atualizacao-de-token.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.
