Fix start.gg OAuth endpoints and document required client config

This commit is contained in:
Pandipipas
2026-02-16 00:45:54 +01:00
parent 78dc137679
commit 19136e6a93
4 changed files with 43 additions and 12 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ onBeforeUnmount(() => {
Integración start.gg
</div>
<div class="text-caption q-mb-md">
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.
</div>
<div class="row q-col-gutter-sm items-center">
<div class="col-12">
+13 -11
View File
@@ -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<string> => {
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;
}
+12
View File
@@ -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;
}