Add temporary debug logging to GitHub OAuth exchange

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nathan Flurry 2026-03-12 22:26:22 -07:00
parent 32a48131b5
commit c410e24057

View file

@ -161,21 +161,34 @@ export class GitHubAppClient {
throw new GitHubAppError("GitHub OAuth is not configured", 500); throw new GitHubAppError("GitHub OAuth is not configured", 500);
} }
const exchangeBody = {
client_id: this.clientId,
client_secret: this.clientSecret,
code,
redirect_uri: this.redirectUri,
};
console.log("[github-oauth] exchangeCode request", {
url: `${this.authBaseUrl}/login/oauth/access_token`,
client_id: this.clientId,
redirect_uri: this.redirectUri,
code_length: code.length,
code_prefix: code.slice(0, 6),
});
const response = await fetch(`${this.authBaseUrl}/login/oauth/access_token`, { const response = await fetch(`${this.authBaseUrl}/login/oauth/access_token`, {
method: "POST", method: "POST",
headers: { headers: {
Accept: "application/json", Accept: "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({ body: JSON.stringify(exchangeBody),
client_id: this.clientId,
client_secret: this.clientSecret,
code,
redirect_uri: this.redirectUri,
}),
}); });
const responseText = await response.text(); const responseText = await response.text();
console.log("[github-oauth] exchangeCode response", {
status: response.status,
body: responseText.slice(0, 300),
});
let payload: GitHubTokenResponse; let payload: GitHubTokenResponse;
try { try {
payload = JSON.parse(responseText) as GitHubTokenResponse; payload = JSON.parse(responseText) as GitHubTokenResponse;