gamesheet_sdk.teams.login¶
HTTP-only login flow for the GameSheet teams dashboard.
Authenticates against the same Firebase project as the admin dashboard (gamesheet-production) but uses
pure HTTP calls instead of headless browser automation:
POSTFirebase RESTsignInWithPasswordwith the project’s API key.GET /api/auth/tokenson the teams API gateway, exchanging the Firebase ID token for application-levelaccess and refresh tokens.
The resulting tokens are persisted via save_tokens() so that
subsequent CLI commands can authenticate without repeating the login flow.
Functions
|
Exchange a refresh token for a fresh |
Classes
HTTP-based |
- gamesheet_sdk.teams.login.refresh_access_token(refresh_token, *, timeout=15.0)[source]¶
Exchange a refresh token for a fresh
{access, refresh}pair via the teams API gateway.POSTs to
TEAMS_REFRESH_PATHwithAuthorization: Bearer <refresh_token>and an empty JSON body. The gateway returns a new access token and a replacement refresh token.This is a standalone HTTP call that does not use a
Session, so it can be called from inside an auto-refresh retry path without recursing.- Parameters:
refresh_token (str) – The refresh token to exchange for new tokens.
timeout (float) – Request timeout in seconds. Defaults to
DEFAULT_TIMEOUT_S.
- Returns:
dict[str, str] –
- Dictionary with keys
accessandrefresh, each containing the corresponding token string.
- Dictionary with keys
- Raises:
AuthenticationError – If the refresh token is rejected (HTTP 401). This typically means the token has expired and the user needs to re-authenticate via
gamesheet-teams login.GameSheetError – For any other non-2xx HTTP response from the token refresh endpoint.
- Return type:
- class gamesheet_sdk.teams.login.TeamsLoginFlow[source]¶
Bases:
objectHTTP-based
LoginFlowfor the teams dashboard.Authenticates via two sequential HTTP calls — Firebase REST
signInWithPasswordfollowed by a token exchange against the teams API gateway — without requiring a headless browser.Example
Authenticating with the teams dashboard:
from gamesheet_sdk.common.config import Config from gamesheet_sdk.teams.login import TeamsLoginFlow config = Config(base_url="https://teams.gamesheet.app") flow = TeamsLoginFlow(config) tokens = flow.authenticate(email="user@example.com", password="secret") print(tokens["access"])
- Parameters:
config (Config) – SDK configuration (credentials, URLs, storage paths).
Initialize TeamsLoginFlow with SDK config.
- Parameters:
config (Config) – SDK configuration (credentials, URLs, storage paths).
- __init__(config)[source]¶
Initialize TeamsLoginFlow with SDK config.
- Parameters:
config (Config) – SDK configuration (credentials, URLs, storage paths).
- authenticate(email=None, password=None, *, timeout=None)[source]¶
Run the HTTP-only teams login and return tokens.
Resolves credentials from the arguments or
Config, authenticates with Firebase, exchanges the ID token for application tokens, and persists them to disk.- Parameters:
- Returns:
dict[str, str] – Token bundle with
"access"and"refresh"keys.- Return type: