Skip to main content

Module auth

Module auth 

Source
Expand description

OAuth2 Authorization Code flow with token refresh for TradeStation API.

TradeStation uses OAuth2 with:

  • Authorization endpoint: https://signin.tradestation.com/authorize
  • Token endpoint: https://signin.tradestation.com/oauth/token
  • Access token lifetime: 20 minutes
  • Refresh token lifetime: ~30 days

§Flow

  1. Build an authorization URL with Credentials::authorization_url.
  2. User visits the URL and grants access.
  3. Exchange the callback code via exchange_code.
  4. The Token auto-refreshes through Client::access_token.

Structs§

Credentials
OAuth2 client credentials for the TradeStation API.
Token
OAuth2 token with expiration tracking.

Enums§

Scope
OAuth2 scopes controlling API access levels.

Functions§

exchange_code
Exchange an authorization code for an access/refresh token pair.
refresh_token
Refresh an expired access token using the refresh token.
revoke_token
Revoke a refresh token, invalidating it for future use.