oauth#

analytix.oauth.create_state() str#

Create a random state for requests.

Returns

The state as a 64-character long hexadecimal string.

analytix.oauth.auth_url_and_state(secrets: Secrets) tuple[str, str]#

Get the authorisation URL and the state.

Parameters

secrets – The project secrets from the Google Developers Console.

Returns

A tuple containing the generated URL and state.

analytix.oauth.access_data_and_headers(code: str, secrets: Secrets) DataHeadersT#

Get the required data and headers for retrieving tokens from the YouTube Token Endpoint.

Parameters
  • code – The authorisation code.

  • secrets – The project secrets from the Google Developers Console.

Returns

A tuple containing the data and headers.

analytix.oauth.refresh_data_and_headers(token: str, secrets: Secrets) DataHeadersT#

Get the required data and headers for refreshing tokens using the YouTube Token Endpoint.

Parameters
  • token – The refresh token.

  • secrets – The project secrets from the Google Developers Console.

Returns

A tuple containing the data and headers.