gamesheet_sdk.common.auth.constants module

Authentication-related constants and configuration values.

This module defines all authentication constants used throughout the gamesheet_sdk.common.auth package, including URL paths, endpoints, and timing parameters for login flows and token operations.

gamesheet_sdk.common.auth.constants.LOGIN_PATH

Path for the login form relative to the base URL.

Type:

str

gamesheet_sdk.common.auth.constants.POST_LOGIN_PATH

Default destination after successful authentication.

Type:

str

gamesheet_sdk.common.auth.constants.FIREBASE_AUTH_HOST

Firebase Authentication service hostname.

Type:

str

gamesheet_sdk.common.auth.constants.FIREBASE_AUTH_PATH

Firebase Authentication endpoint path.

Type:

str

gamesheet_sdk.common.auth.constants.FIREBASE_AUTH_URL

Full Firebase Authentication REST URL.

Type:

str

gamesheet_sdk.common.auth.constants.TOKEN_EXCHANGE_PATH

GameSheet token exchange API endpoint.

Type:

str

gamesheet_sdk.common.auth.constants.TOKEN_EXCHANGE_URL

Full URL for token exchange.

Type:

str

gamesheet_sdk.common.auth.constants.REFRESH_URL

Full URL for refreshing access tokens.

Type:

str

gamesheet_sdk.common.auth.constants.REFRESH_TIMEOUT_S

Timeout in seconds for token refresh operations.

Type:

float

gamesheet_sdk.common.auth.constants.DEFAULT_TIMEOUT_S

Default timeout in seconds for HTTP requests.

Type:

float

gamesheet_sdk.common.auth.constants.POLL_INTERVAL_MS

Polling interval in milliseconds for browser state checks.

Type:

int

gamesheet_sdk.common.auth.constants.POST_LOGIN_NAVIGATION_TIMEOUT_MS

Timeout in milliseconds for post-login navigation.

Type:

int

gamesheet_sdk.common.auth.constants.FORM_DETECTION_TIMEOUT_MS

Timeout in milliseconds for detecting the login form.

Type:

int

Examples

Using authentication constants in login flows:

from gamesheet_sdk.common.auth.constants import (
    DEFAULT_TIMEOUT_S,
    LOGIN_PATH,
    POST_LOGIN_PATH,
)

login_url = f"{base_url}{LOGIN_PATH}"
response = session.get(login_url, timeout=DEFAULT_TIMEOUT_S)

Using timeout constants with Playwright:

from gamesheet_sdk.common.auth.constants import (
    FORM_DETECTION_TIMEOUT_MS,
    POST_LOGIN_NAVIGATION_TIMEOUT_MS,
)

page.wait_for_selector("#email", timeout=FORM_DETECTION_TIMEOUT_MS)
page.wait_for_url(pattern, timeout=POST_LOGIN_NAVIGATION_TIMEOUT_MS)

Using Firebase and token exchange constants:

from gamesheet_sdk.common.auth.constants import (
    FIREBASE_AUTH_HOST,
    FIREBASE_AUTH_PATH,
    TOKEN_EXCHANGE_PATH,
)

firebase_url = f"https://{FIREBASE_AUTH_HOST}{FIREBASE_AUTH_PATH}"
token_url = f"{base_url}{TOKEN_EXCHANGE_PATH}"