From 19136e6a93b3ecd59c9b829b08cbd459eea7d8b9 Mon Sep 17 00:00:00 2001 From: Pandipipas <62224708+Pandipipas@users.noreply.github.com> Date: Mon, 16 Feb 2026 00:45:54 +0100 Subject: [PATCH] Fix start.gg OAuth endpoints and document required client config --- configschema.json | 17 +++++++++++++++ src/dashboard/scoreko-dev/views/Players.vue | 2 +- src/extension/startgg.ts | 24 +++++++++++---------- src/types/schemas/configschema.d.ts | 12 +++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/configschema.json b/configschema.json index fd5bfda..9488047 100644 --- a/configschema.json +++ b/configschema.json @@ -5,6 +5,23 @@ "properties": { "exampleProperty": { "type": "string" + }, + "startggClientId": { + "type": "string", + "default": "", + "description": "Client ID de tu OAuth app de start.gg" + }, + "startggClientSecret": { + "type": "string", + "default": "", + "description": "Client Secret de tu OAuth app de start.gg" + }, + "startggOAuthPort": { + "type": "integer", + "default": 34920, + "minimum": 1, + "maximum": 65535, + "description": "Puerto local para callback OAuth" } }, "required": [ diff --git a/src/dashboard/scoreko-dev/views/Players.vue b/src/dashboard/scoreko-dev/views/Players.vue index 00ad156..34a4a4a 100644 --- a/src/dashboard/scoreko-dev/views/Players.vue +++ b/src/dashboard/scoreko-dev/views/Players.vue @@ -425,7 +425,7 @@ onBeforeUnmount(() => { Integración start.gg
- Conecta por OAuth (recomendado) o pega tu token personal para cargar tus torneos creados o donde eres admin. + Conecta por OAuth (recomendado) o pega tu token personal para cargar tus torneos creados o donde eres admin. Si aparece "Client authentication failed", revisa que en config uses el Client ID/Secret de un OAuth App de start.gg.
diff --git a/src/extension/startgg.ts b/src/extension/startgg.ts index 26c1285..9242308 100644 --- a/src/extension/startgg.ts +++ b/src/extension/startgg.ts @@ -4,8 +4,8 @@ import { getData, type CountryRecord } from 'country-list'; import { nodecg } from './util/nodecg.js'; const STARTGG_ENDPOINT = 'https://api.start.gg/gql/alpha'; -const STARTGG_OAUTH_AUTHORIZE_ENDPOINT = 'https://start.gg/oauth/authorize'; -const STARTGG_OAUTH_TOKEN_ENDPOINT = 'https://api.start.gg/oauth/token'; +const STARTGG_OAUTH_AUTHORIZE_ENDPOINT = 'https://api.start.gg/oauth/authorize'; +const STARTGG_OAUTH_TOKEN_ENDPOINT = 'https://api.start.gg/oauth/access_token'; const STARTGG_OAUTH_SCOPES = 'user.identity tournament.manager'; const STARTGG_OAUTH_CALLBACK_PATH = '/startgg/callback'; const STARTGG_OAUTH_DEFAULT_PORT = 34920; @@ -168,18 +168,20 @@ const exchangeOAuthCodeForToken = async ( redirectUri: string, oauthConfig: OAuthConfig, ): Promise => { + const params = new URLSearchParams({ + grant_type: 'authorization_code', + code, + client_id: oauthConfig.clientId, + client_secret: oauthConfig.clientSecret, + redirect_uri: redirectUri, + }); + const response = await fetch(STARTGG_OAUTH_TOKEN_ENDPOINT, { method: 'POST', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'application/x-www-form-urlencoded', }, - body: JSON.stringify({ - grant_type: 'authorization_code', - code, - client_id: oauthConfig.clientId, - client_secret: oauthConfig.clientSecret, - redirect_uri: redirectUri, - }), + body: params.toString(), }); const payload = (await response.json()) as OAuthTokenResponse; @@ -302,7 +304,7 @@ const ensureOAuthCallbackServer = async (oauthConfig: OAuthConfig) => { nodecg.listenFor('startgg:createOAuthSession', async (_payload: unknown, ack) => { const oauthConfig = getOAuthConfig(); if (!oauthConfig) { - sendAck(ack, 'OAuth no está configurado en esta instalación (faltan startggClientId/startggClientSecret).'); + sendAck(ack, 'OAuth no está configurado en esta instalación (faltan startggClientId/startggClientSecret). Usa el Client ID y Client Secret del OAuth app de start.gg.'); return; } diff --git a/src/types/schemas/configschema.d.ts b/src/types/schemas/configschema.d.ts index 7f91b92..f5f456d 100644 --- a/src/types/schemas/configschema.d.ts +++ b/src/types/schemas/configschema.d.ts @@ -8,4 +8,16 @@ export interface Configschema { exampleProperty: string; + /** + * Client ID de tu OAuth app de start.gg + */ + startggClientId?: string; + /** + * Client Secret de tu OAuth app de start.gg + */ + startggClientSecret?: string; + /** + * Puerto local para callback OAuth + */ + startggOAuthPort?: number; }