Skip to main content

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. CLI — ebay-oauth setup runs the full OAuth flow and gives you a refresh token
  2. Library — EbayOAuthClient 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

Metadata

Release files for ldraney-ebay-oauth 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldraney-ebay-oauth 0.1.0
File Size Uploaded
ldraney_ebay_oauth-0.1.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ldraney-ebay-oauth 0.1.0
File Interpreter ABI Platform
ldraney_ebay_oauth-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / ldraney_ebay_oauth-0.1.0.tar.gz

Download URL ldraney_ebay_oauth-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e38e9f26b90786a993f9c57c494e915b4e0ebbf839a69334c8f97367bd5ca14d
BLAKE2b-256 checksum
How to use checksums
ffc6d3a936643511e96149a0c04331597279eb8b9e022f3c07a90a92864a4507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.13.7 Darwin/25.2.0

Release files / ldraney_ebay_oauth-0.1.0-py3-none-any.whl

Download URL ldraney_ebay_oauth-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82e5cff5ec1e2934c4163b2497ee01fcc165d41fc37463ef6c649ca515bb2320
BLAKE2b-256 checksum
How to use checksums
ac1e1d1697111b7527ad764207a9baf59d1657ea14359e957ad764f7b9283e6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.13.7 Darwin/25.2.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page