class xdk.oauth2_auth.OAuth2PKCEAuth
OAuth2 PKCE authentication for the X API.
Parameters
__init__
Initialize the OAuth2 PKCE authentication.
Parameters
The base URL for the X API.
The client ID for the X API.
The client secret for the X API.
The redirect URI for OAuth2 authorization.
An existing OAuth2 token dictionary (if available).
Space-separated list of scopes for OAuth2 authorization.
fetch_token
Fetch token using authorization response and code verifier.
Parameters
The full callback URL received after authorization
Returns
Dictstr, Any
get_authorization_url
Get the authorization URL for the OAuth2 PKCE flow.
:returns: (authorization_url, state)
:rtype: tuple
Returns
Tuplestr, str
is_token_expired
Check if the token is expired.
:returns: True if the token is expired, False otherwise.
:rtype: bool
Returns
bool
refresh_token
Refresh the access token.
:returns: The refreshed token dictionary
:rtype: Dict[str, Any]
Returns
Dictstr, Any