Battles Record uses a secure OAuth proxy hosted on TeamBattles to authenticate with Kick. This keeps the OAuth client secret secure on the server while allowing the desktop app to complete the authentication flow.Documentation Index
Fetch the complete documentation index at: https://teambattles.gg/docs/llms.txt
Use this file to discover all available pages before exploring further.
Why a Proxy?
Kick’s OAuth 2.1 implementation requiresclient_secret even when using PKCE. For a public desktop application, we cannot safely bundle the secret (it could be extracted). The proxy:
- Keeps
client_secretsecure on the server - Accepts authorization codes from the desktop app
- Exchanges them with Kick’s OAuth server
- Returns access tokens to the app
Endpoints
All endpoints are hosted athttps://teambattles.gg/api/v1/kick/.
Token Exchange
Exchange an authorization code for access tokens.| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Authorization code received from Kick OAuth redirect |
code_verifier | string | Yes | PKCE code verifier (43-128 characters) that matches the code_challenge sent in authorization request |
redirect_uri | string | Yes | Must match the redirect_uri used in the authorization request |
battles-record://oauth/callback(production)http://localhost:1420/auth/callback(development)
Missing or invalid parameters, or Kick OAuth error.Common error codes:
invalid_grant- Code expired, already used, or code_verifier doesn’t matchinvalid_request- Malformed request or missing parameters
Failed to communicate with Kick OAuth server.
Token Refresh
Refresh an expired access token using a refresh token.| Field | Type | Required | Description |
|---|---|---|---|
refresh_token | string | Yes | Refresh token obtained from initial token exchange |
Missing parameter or invalid/expired refresh token.
Authentication Flow
Here’s how Battles Record authenticates with Kick:Generate PKCE
Generate a
code_verifier (43-128 random characters) and code_challenge (Base64URL(SHA256(code_verifier))).Token Refresh Flow
Refresh tokens before they expire to maintain uninterrupted access:- Monitor token expiration (refresh when less than 10 minutes remain)
- POST to the refresh endpoint with your refresh token
- Store the new tokens (Kick may return a new refresh token)
- Update any active API connections
Comparison with Other Platforms
| Platform | Token Exchange | Refresh | Secret Required |
|---|---|---|---|
| Twitch | Direct to Twitch (PKCE) | Direct to Twitch | No |
| YouTube | Direct to Google (PKCE) | Direct to Google | No |
| Kick | Via TeamBattles proxy | Via TeamBattles proxy | Yes (server-side) |
Security Notes
- The proxy validates
redirect_uriagainst an allowlist to prevent authorization code injection - Tokens and secrets are never logged
- Requests timeout after 10 seconds to prevent hanging
- All communication uses HTTPS