Skip to main content

Client library for ExtraSuite - secure OAuth token exchange for CLI tools

Project description

extrasuite

Python client library for ExtraSuite - secure OAuth token exchange for AI agents and CLI tools.

Installation

pip install extrasuite

Quick Start

CLI Authentication

# Login (opens browser for OAuth)
python -m extrasuite.client login

# Or using the console script
extrasuite login

# Logout (clears cached credentials)
python -m extrasuite.client logout

Programmatic Usage

from extrasuite.client import authenticate

# Get a token - opens browser for authentication if needed
token = authenticate()

# Use the token with Google APIs
import gspread
from google.oauth2.credentials import Credentials

creds = Credentials(token.access_token)
gc = gspread.authorize(creds)
sheet = gc.open("My Spreadsheet").sheet1

Configuration

Authentication can be configured via:

  1. Constructor parameters (highest priority)
  2. Environment variables
  3. Gateway config file ~/.config/extrasuite/gateway.json (created by skill installation)

Environment Variables

Variable Description
EXTRASUITE_AUTH_URL URL to start authentication flow
EXTRASUITE_EXCHANGE_URL URL to exchange auth code for token
SERVICE_ACCOUNT_PATH Path to service account JSON file (alternative auth)

Using CredentialsManager

For more control, use the CredentialsManager class directly:

from extrasuite.client import CredentialsManager

manager = CredentialsManager(
    auth_url="https://your-server.example.com/api/token/auth",
    exchange_url="https://your-server.example.com/api/token/exchange",
)

token = manager.get_token()
print(f"Service account: {token.service_account_email}")
print(f"Expires in: {token.expires_in_seconds()} seconds")

Service Account Mode

For non-interactive environments, you can use a service account file:

from extrasuite.client import CredentialsManager

manager = CredentialsManager(service_account_path="/path/to/service-account.json")
token = manager.get_token()

Note: Service account mode requires the google-auth package:

pip install google-auth

Token Storage

Tokens are securely stored in the OS keyring:

  • macOS: Keychain
  • Windows: Credential Locker
  • Linux: Secret Service (via libsecret)

How It Works

  1. When you call authenticate() or get_token(), the client checks the OS keyring for a cached token
  2. If no valid cached token exists, it starts a local HTTP server and opens your browser
  3. After authentication with the ExtraSuite server, the browser redirects back with an auth code
  4. The client exchanges the auth code for a short-lived access token
  5. The token is cached in the OS keyring for subsequent calls

Tokens are short-lived (1 hour) and automatically refreshed when expired.

API Reference

authenticate()

Convenience function to get a token with minimal code.

from extrasuite.client import authenticate

token = authenticate(
    auth_url=None,           # Optional: override auth URL
    exchange_url=None,       # Optional: override exchange URL
    service_account_path=None,  # Optional: use service account instead
    force_refresh=False,     # Force re-authentication
)

Token

The token object returned by authentication.

token.access_token          # The OAuth2 access token string
token.service_account_email # Email of the service account
token.expires_at            # Unix timestamp when token expires
token.is_valid()            # Check if token is still valid
token.expires_in_seconds()  # Seconds until expiration

Requirements

  • Python 3.10+
  • Dependencies: keyring, certifi

For Google Sheets/Docs/Slides integration:

pip install gspread google-auth

License

MIT - Copyright (c) 2026 Think41 Technologies Pvt. Ltd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

extrasuite-0.8.0.tar.gz (76.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

extrasuite-0.8.0-py3-none-any.whl (109.2 kB view details)

Uploaded Python 3

File details

Details for the file extrasuite-0.8.0.tar.gz.

File metadata

  • Download URL: extrasuite-0.8.0.tar.gz
  • Upload date:
  • Size: 76.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for extrasuite-0.8.0.tar.gz
Algorithm Hash digest
SHA256 f4aa733f1188c77d33769f03b88772bcf65eee22edf5d9b074844c1e320992aa
MD5 722dc28c46e80f7b22742d1b8df76e0e
BLAKE2b-256 921f7562f9b96c36bd853fe06f898976f65968c7818c577a8797359edfeef902

See more details on using hashes here.

Provenance

The following attestation bundles were made for extrasuite-0.8.0.tar.gz:

Publisher: publish-extrasuite.yml on think41/extrasuite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file extrasuite-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: extrasuite-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 109.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for extrasuite-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2979b1fe52c25445af78beca4aba359e3d6276600a7495d9786b7189f74a24a5
MD5 dc3091174be9d5ce363540445523b3bf
BLAKE2b-256 a660d58ee1f7100ab176bf0137033bca5aaee76c7132333818c793d8770e0c84

See more details on using hashes here.

Provenance

The following attestation bundles were made for extrasuite-0.8.0-py3-none-any.whl:

Publisher: publish-extrasuite.yml on think41/extrasuite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page