> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/connections-and-tool-execution/token-refresh-expiration-and-reconnection.md).

# Token Refresh, Expiration, and Reconnection

A connection can stop working when its credential expires or the provider revokes access. Reconnect the account to restore authorization.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FkyJ4klpZcLHIiou3FXkp%2FG046.mp4?alt=media&token=0c8af3e9-77af-4dd0-bbda-41dc649fe3b3>" %}

## Before you begin

Permission to manage the affected connection.

## Key concepts

| Term          | Definition                                                                                                                                          |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Access token  | A credential used to authorize requests for its valid lifetime. Expiration or revocation can prevent an otherwise valid operation.                  |
| Refresh token | A credential that a provider may issue to obtain a new access token. Revoked consent or provider policy can still require reconnecting the account. |
| Revocation    | Withdrawal of a credential or access grant. Check dependent applications and separately issued links when access changes.                           |
| Reconnection  | Repeating the supported authorization flow for a saved connection. Confirm the account and resource access after reconnecting.                      |

## Reconnect an expired connection

1. Read the failed operation’s authentication error.

![Select the provider whose account the operation needs to access.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/Xgr4UtJCP5PpVQrKbs4Z/assets/g046-g046-01-provider.png)

Select the provider whose account the operation needs to access.

2. Open the connection and reconnect or update its credential using the supported controls.
3. Repeat a read operation and confirm that the expected resources are available.

The connection works with the intended account and permissions.

## Behavior and limitations

Some OAuth providers allow automatic token refresh; revoked consent or changed permissions can still require sign-in. Repeatedly running a workflow does not repair an invalid credential. An authorization error can also mean the account lacks access to a particular resource, even when the connection itself remains valid.

## Related resources

[Create and manage connections](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/create-and-manage-connections.md)

[Connection Ownership, Sharing, and Permissions](https://docs.stackai.com/technical-reference/connections-and-tool-execution/connection-ownership-sharing-and-permissions.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/connections-and-tool-execution/token-refresh-expiration-and-reconnection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
