For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Fork this repoGet a demo
  • Docs
    • Welcome
    • Quickstart
    • Concepts
    • Search
    • MCP Server
    • CLI
    • Agent Skills
    • Connect
    • Add New Connector
    • Rate Limits
      • OAuth
      • Direct Token Injection
  • API Reference
LogoLogo
Fork this repoGet a demo
On this page
  • Use case
  • Create a source connection with your own tokens
  • Trigger a sync
  • Auth provider connections
DocsAuthentication

Direct Token Injection

Create source connections or trigger syncs by supplying OAuth 2.0 tokens directly.

Was this page helpful?
Edit this page
Previous

Connectors

Next
Built with

Use case

If you embed Airweave inside your own product you might already manage OAuth 2.0 tokens for your users. In that case, you do not want to have to ask them to click through a second consent screen for Airweave. Airweave therefore allows you to provide existing tokens to Airweave directly, so that

  • Your service owns token storage and rotation.
  • Airweave consumes the tokens solely for data sync.
  • No additional user interaction required.

There are two common scenarios:

  1. Create a new source connection by sending the access token.
  2. Trigger a sync on an existing source connection using stored credentials.

The next sections walk you through both flows.

Create a source connection with your own tokens

Skip the OAuth 2.0 flow entirely by sending your own tokens in the POST /source-connections call. You are responsible for acquiring and storing these tokens, Airweave simply uses what you provide.

Creating a source connection with direct tokens looks like this:

1from airweave import AirweaveSDK
2from airweave.types import OAuthTokenAuthentication
3
4airweave = AirweaveSDK(api_key="YOUR_API_KEY", base_url="https://api.airweave.ai")
5
6source_connection = airweave.source_connections.create(
7 name="Asana connection",
8 short_name="asana",
9 readable_collection_id="my-collection-id",
10 authentication=OAuthTokenAuthentication(
11 access_token="YOUR_ACCESS_TOKEN",
12 ),
13 sync_immediately=True
14)

Trigger a sync

The run endpoint uses the stored credentials from the source connection. To use different credentials, create a new source connection with OAuthTokenAuthentication.
By default, Airweave uses the credentials obtained during the initial OAuth 2.0 handshake to run a data synchronization job.

Here is an example:

1from airweave import AirweaveSDK
2
3airweave = AirweaveSDK(api_key="YOUR_API_KEY", base_url="https://api.airweave.ai")
4
5job = airweave.source_connections.run(
6 source_connection_id="source_connection_id"
7)

Auth provider connections

Airweave also supports creating source connections through auth providers like Composio and Pipedream. Check out the Authentication Providers documentation to learn more.

If you have an edge case that isn’t covered by these features, please let us know at hello@airweave.ai.