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
- The tool constructs an authorization URL and opens it in your default browser
- A local HTTP server starts to listen for the OAuth callback
- After you authorize the application in your browser, cTrader redirects back to the local server
- The tool exchanges the authorization code for access and refresh tokens
- 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
- Go to cTrader Open API
- Register or log in to your account
- Create a new application
- Note your client ID and client secret
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ctrader_oauth_fetcher-1.0.0.tar.gz.
File metadata
- Download URL: ctrader_oauth_fetcher-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89349a4ad788727b565c714ffe6d66b42b30336ed16e7822c55820c17a57d4f1
|
|
| MD5 |
54eb5572063fb03ea1294a2fae20af9d
|
|
| BLAKE2b-256 |
935671bcf4078be38fbced3c1cda70012cdb019ec2655e1a51205f9f967c6035
|
File details
Details for the file ctrader_oauth_fetcher-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ctrader_oauth_fetcher-1.0.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4759d6b4f283ddbb0d09880f9cd6131278fcb01af201eafaee12742bcbf12abe
|
|
| MD5 |
d5085b02b5a5d954a428ec7ae5867fd3
|
|
| BLAKE2b-256 |
73a0926fcd70107535049893e40dec4458194ecfdcd56912459ce0fd98541d7a
|