Skip to main content

Module auth

Module auth 

Source
Expand description

Token management — exchanging credentials for JWTs.

The Chalk API uses OAuth2 client-credentials flow:

  1. You POST your client_id + client_secret to /v1/oauth/token.
  2. The server returns a JWT (access_token) that expires after some time.
  3. You attach this JWT as a Bearer token on every subsequent request.

This module handles the exchange and caches the token so we don’t hit the auth endpoint on every single query. The cache is thread-safe (using tokio::sync::RwLock) so multiple async tasks can share a single TokenManager.

Structs§

TokenManager
Manages authentication tokens for the Chalk client.