Skip to content

OAuthTokenRequest

QuantConnect.Brokerages.Authentication.OAuthTokenRequest

OAuthTokenRequest(
    brokerage: str,
    account_id: str,
    refresh_token: str = None,
    deploy_id: str = None,
)

Bases: Object

Represents a Lean platform token request, including all fields required by the live/auth0/refresh endpoint. Optional fields are omitted from JSON when null.

Initializes a new instance of OAuthTokenRequest with all fields. Use named parameters to supply only the fields required by the target brokerage.

Parameters:

Name Type Description Default
brokerage str

The brokerage name. Normalized to lowercase.

required
account_id str

The account number or identifier.

required
refresh_token str

OAuth refresh token; omitted from JSON when null.

None
deploy_id str

Lean deploy identifier; omitted from JSON when null.

None

brokerage

brokerage: str

Gets the name of the brokerage associated with the access token request. The value is normalized to lowercase.

account_id

account_id: str

Gets the account identifier associated with the brokerage.

refresh_token

refresh_token: str

Gets the OAuth refresh token used to obtain a new access token. Omitted from JSON when null.

deploy_id

deploy_id: str

Gets the Lean deploy identifier for brokerages that require it. Omitted from JSON when null.

to_json

to_json() -> str

Serializes the request into a compact camelCase JSON string. Null properties are excluded from the output.

Returns:

Type Description
str

A JSON string representing the current request.