OAuthTokenAuthentication Class

OAuth Token Authentication.

Requires that supplied token contains an expires_in field.

Inheritance
OAuthTokenAuthentication

Constructor

OAuthTokenAuthentication(client_id: str, token: Dict[str, str])

Parameters

client_id
str
Required

Account Client ID.

token
dict[<xref:str,str>]
Required

OAuth2 token.

Methods

construct_auth

Format token header.

refresh_session

Return updated session if token has expired, attempts to refresh using refresh token.

If a session object is provided, configure it directly. Otherwise, create a new session and return it.

signed_session

Create requests session with any required auth headers applied.

If a session object is provided, configure it directly. Otherwise, create a new session and return it.

construct_auth

Format token header.

construct_auth() -> str

Return type

str

refresh_session

Return updated session if token has expired, attempts to refresh using refresh token.

If a session object is provided, configure it directly. Otherwise, create a new session and return it.

refresh_session(session: Optional[requests.sessions.Session] = None) -> requests.sessions.Session

Parameters

session
<xref:requests.Session>
default value: None

The session to configure for authentication

Return type

<xref:requests.Session>

signed_session

Create requests session with any required auth headers applied.

If a session object is provided, configure it directly. Otherwise, create a new session and return it.

signed_session(session: Optional[requests.sessions.Session] = None) -> requests.sessions.Session

Parameters

session
<xref:requests.Session>
default value: None

The session to configure for authentication

Return type

<xref:requests.Session>