Skip to main content

One-time OAuth token fetcher for cTrader Open API

Project description

ctrader-oauth-fetcher

A command-line utility for obtaining OAuth tokens from the cTrader Open API. This tool automates the OAuth 2.0 authorization code flow, handling browser-based authorization and token exchange.

Requirements

  • Python 3.14+
  • A cTrader Open API application (client ID and secret)

Usage

Run directly without installation using uvx:

uvx ctrader-oauth-fetcher --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET

With all options:

ctrader-oauth-fetcher \
  --client-id YOUR_CLIENT_ID \
  --client-secret YOUR_CLIENT_SECRET \
  --scope trading \
  --redirect-uri http://localhost:8080

Options

Option Required Default Description
--client-id Yes - OAuth application client ID
--client-secret Yes - OAuth application client secret
--scope No trading Permission scope: trading or accounts
--redirect-uri No http://localhost:8080 OAuth callback URL

Scopes

  • trading - Full trading permissions (place orders, manage positions)
  • accounts - Read-only access to account information

How It Works

  1. The tool constructs an authorization URL and opens it in your default browser
  2. A local HTTP server starts to listen for the OAuth callback
  3. After you authorize the application in your browser, cTrader redirects back to the local server
  4. The tool exchanges the authorization code for access and refresh tokens
  5. Tokens are displayed in the terminal

Output

On success, the tool outputs the token response:

Tokens Received successfully.

Access token: <TOKEN>
Refresh token: <TOKEN>
Expires in: <SECONDS> seconds

Getting cTrader API Credentials

  1. Go to cTrader Open API
  2. Register or log in to your account
  3. Create a new application
  4. Note your client ID and client secret

License

MIT License - see LICENSE for details.

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

ctrader_oauth_fetcher-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

ctrader_oauth_fetcher-1.0.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file ctrader_oauth_fetcher-1.0.1.tar.gz.

File metadata

  • Download URL: ctrader_oauth_fetcher-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ctrader_oauth_fetcher-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c134c7250d1b2b7fa672bf2f99e10cd3103ccdaa98bd4da7f0b8bc95a1677432
MD5 f48e2cabbc46573fa8b63d64b6bed1ec
BLAKE2b-256 577dcb3ff77547d6a1cec6f17dbaa48e261b4c71d16317a8a631d57745479fbc

See more details on using hashes here.

File details

Details for the file ctrader_oauth_fetcher-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ctrader_oauth_fetcher-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ctrader_oauth_fetcher-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6dc84535b6663611bad80ddf1e1eef59e1f6bddb0f9c86a982ab58440c156b05
MD5 7d1850c091de8ef2c1a6d8bc33059723
BLAKE2b-256 f173cf8af02c41e962ea6760dd2f253b948bf9d7abeb35731311359548e3b141

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