> ## Documentation Index
> Fetch the complete documentation index at: https://pipedream.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Tokens

When you initiate account connection for your end users, you must either:

1. Generate a secure, short-lived token scoped to the end user, or
2. Use the [Connect Link](/connect/managed-auth/connect-link/) feature to generate a URL that guides the user through the account connection flow without any frontend work on your side.

Here, we’ll show you how to generate tokens for your users and return that to your frontend, passing that to the account connection flow.

Use tokens when you want to handle the account connection flow yourself, in your app’s UI. For example, you might want to show a **Connect Slack** button in your app that triggers the account connection flow for Slack, or launch the flow in a modal.

<Note>
  Connect tokens currently have a 4-hour expiry, and can only be used once.
</Note>

## Creating a token

See docs on [the `/tokens` endpoint](/connect/api-reference/create-connect-token) to create new tokens.

## Webhooks

When you generate a token, you can specify a `webhook_uri` where Pipedream will deliver updates on the account connection flow. This is useful if you want to update your UI based on the status of the account connection flow, get a log of errors, and more.

[See the webhooks docs](/connect/webhooks#connection-webhooks) for more information.

## Tokens are scoped to end users and environments

When you [create a new Connect token](/connect/api-reference/create-connect-token), you pass an `external_user_id` and an `environment`. See the docs on [environments](/connect/managed-auth/environments/) for more information on passing environment in the SDK and API.

Tokens are scoped to this user and environment. When the user successfully connects an account with that token, it will be saved for that `external_user_id` in the specified environment.
