diff --git a/docs/authentication.md b/docs/authentication.md index c58ceed1c..0e8bb4642 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -11,6 +11,15 @@ For programmatic access (the SDK, scripts, agents) you authenticate with the Create a client ID and secret under [Rapidata Settings → Tokens](https://app.rapidata.ai/settings/tokens). +## Programmatic / agent authentication, step by step + +For headless or agent-driven use, authenticate with the client-credentials grant: + +1. Create a client ID and secret at [Rapidata Settings → Tokens](https://app.rapidata.ai/settings/tokens). +2. Expose them to the SDK as the `RAPIDATA_CLIENT_ID` and `RAPIDATA_CLIENT_SECRET` environment variables, so no interactive browser login is needed. +3. Construct `RapidataClient()` with no arguments — it exchanges the credentials for a bearer token at `https://auth.rapidata.ai/connect/token` and refreshes it automatically. +4. To call the API without the SDK, request a token yourself and send it as a bearer token (see [Direct token request](#direct-token-request)). + ## With the SDK The SDK performs the token exchange for you. Pass the credentials directly: diff --git a/site_root/developers/index.html b/site_root/developers/index.html index ce3b651c0..a9379a29c 100644 --- a/site_root/developers/index.html +++ b/site_root/developers/index.html @@ -50,6 +50,16 @@

Get started

  • Create API credentials (client ID & secret)
  • +

    Authenticate as an agent

    +

    The API uses OAuth 2.0 (OpenID Connect), client-credentials grant:

    +
      +
    1. Create a client ID & secret.
    2. +
    3. Set RAPIDATA_CLIENT_ID and RAPIDATA_CLIENT_SECRET in the environment.
    4. +
    5. Construct RapidataClient() — it fetches and refreshes a bearer token automatically.
    6. +
    7. Without the SDK: POST https://auth.rapidata.ai/connect/token with grant_type=client_credentials, then send the token as Authorization: Bearer ….
    8. +
    +

    Full details: Authentication.

    +

    Reference