Skip to main content

eBay OAuth 2.0 client and CLI — token acquisition, refresh, and keychain storage

Project description

eBay OAuth

What This Is

A Python CLI tool and library for eBay OAuth 2.0 Authorization Code Grant flow. Gets a refresh token, manages token lifecycle.

Related Projects

  • ebay-mcp-server — MCP server for creating eBay listings via Claude. Depends on this package for auth.

Two Interfaces

  1. CLIebay-oauth setup runs the full OAuth flow and gives you a refresh token
  2. LibraryEbayOAuthClient provides get_access_token() with auto-refresh

Key Commands

poetry add ebay-oauth    # or: pip install ebay-oauth
ebay-oauth setup          # interactive OAuth flow
ebay-oauth status         # check if token is valid
ebay-oauth refresh        # force token refresh

Library Usage

from ebay_oauth import EbayOAuthClient

client = EbayOAuthClient(
    client_id="...",
    client_secret="...",
    refresh_token="...",
    environment="sandbox"
)
token = client.get_access_token()  # auto-refreshes

Environment Variables

  • EBAY_CLIENT_ID
  • EBAY_CLIENT_SECRET
  • EBAY_REFRESH_TOKEN
  • EBAY_ENVIRONMENT (sandbox | production)

eBay OAuth Specifics

  • Auth header: Basic base64(client_id:client_secret)
  • Access token TTL: 2 hours
  • Refresh token TTL: 18 months
  • Sandbox token endpoint: https://api.sandbox.ebay.com/identity/v1/oauth2/token
  • Production token endpoint: https://api.ebay.com/identity/v1/oauth2/token
  • Sandbox consent: https://auth.sandbox.ebay.com/oauth2/authorize
  • Production consent: https://auth.ebay.com/oauth2/authorize

Deployment

  • Local mode (default): localhost callback server, works for sandbox
  • fly.io mode (--remote): for production eBay apps that require HTTPS redirect URIs

Package Management

Uses Poetry for dependency management and publishing:

poetry install          # install deps
poetry run pytest       # run tests
poetry build            # build wheel + sdist
poetry publish          # publish to PyPI

Testing

poetry run pytest tests/

Tests mock eBay API responses. No real eBay calls in unit tests.

File Structure

ebay-oauth/
├── src/
│   └── ebay_oauth/
│       ├── __init__.py
│       ├── auth.py
│       ├── server.py
│       ├── cli.py
│       └── config.py
├── tests/
├── docs/
│   ├── architecture.html
│   ├── roadmap.html
│   └── user-story.html
├── fly.toml
├── pyproject.toml
└── CLAUDE.md

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

ldraney_ebay_oauth-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

ldraney_ebay_oauth-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file ldraney_ebay_oauth-0.1.0.tar.gz.

File metadata

  • Download URL: ldraney_ebay_oauth-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Darwin/25.2.0

File hashes

Hashes for ldraney_ebay_oauth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e38e9f26b90786a993f9c57c494e915b4e0ebbf839a69334c8f97367bd5ca14d
MD5 9e8f6e4de3784bdfcb6474e60991cd11
BLAKE2b-256 ffc6d3a936643511e96149a0c04331597279eb8b9e022f3c07a90a92864a4507

See more details on using hashes here.

File details

Details for the file ldraney_ebay_oauth-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ldraney_ebay_oauth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82e5cff5ec1e2934c4163b2497ee01fcc165d41fc37463ef6c649ca515bb2320
MD5 b68c87fe249af1c0efd39d6545f14b36
BLAKE2b-256 ac1e1d1697111b7527ad764207a9baf59d1657ea14359e957ad764f7b9283e6b

See more details on using hashes here.

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