fix: add missing clientId to github provider config for OAuth token refresh (#442)
The github provider in open-sse/config/providers.js was missing clientId, causing refreshGitHubToken() to send client_id=undefined on 401 retry. Also guard against undefined clientSecret in both refresh implementations. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -168,7 +168,8 @@ export const PROVIDERS = {
|
|||||||
"X-Initiator": "user",
|
"X-Initiator": "user",
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
},
|
||||||
|
clientId: "Iv1.b507a08c87ecfe98"
|
||||||
},
|
},
|
||||||
kiro: {
|
kiro: {
|
||||||
baseUrl: "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",
|
baseUrl: "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",
|
||||||
|
|||||||
@@ -243,15 +243,19 @@ export class GithubExecutor extends BaseExecutor {
|
|||||||
|
|
||||||
async refreshGitHubToken(refreshToken, log) {
|
async refreshGitHubToken(refreshToken, log) {
|
||||||
try {
|
try {
|
||||||
|
const params = {
|
||||||
|
grant_type: "refresh_token",
|
||||||
|
refresh_token: refreshToken,
|
||||||
|
client_id: this.config.clientId,
|
||||||
|
};
|
||||||
|
if (this.config.clientSecret) {
|
||||||
|
params.client_secret = this.config.clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(OAUTH_ENDPOINTS.github.token, {
|
const response = await fetch(OAUTH_ENDPOINTS.github.token, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json" },
|
headers: { "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json" },
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams(params)
|
||||||
grant_type: "refresh_token",
|
|
||||||
refresh_token: refreshToken,
|
|
||||||
client_id: this.config.clientId,
|
|
||||||
client_secret: this.config.clientSecret
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
if (!response.ok) return null;
|
if (!response.ok) return null;
|
||||||
const tokens = await response.json();
|
const tokens = await response.json();
|
||||||
|
|||||||
@@ -373,18 +373,22 @@ export async function refreshIflowToken(refreshToken, log) {
|
|||||||
* Specialized refresh for GitHub Copilot OAuth tokens
|
* Specialized refresh for GitHub Copilot OAuth tokens
|
||||||
*/
|
*/
|
||||||
export async function refreshGitHubToken(refreshToken, log) {
|
export async function refreshGitHubToken(refreshToken, log) {
|
||||||
|
const params = {
|
||||||
|
grant_type: "refresh_token",
|
||||||
|
refresh_token: refreshToken,
|
||||||
|
client_id: PROVIDERS.github.clientId,
|
||||||
|
};
|
||||||
|
if (PROVIDERS.github.clientSecret) {
|
||||||
|
params.client_secret = PROVIDERS.github.clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(OAUTH_ENDPOINTS.github.token, {
|
const response = await fetch(OAUTH_ENDPOINTS.github.token, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams(params),
|
||||||
grant_type: "refresh_token",
|
|
||||||
refresh_token: refreshToken,
|
|
||||||
client_id: PROVIDERS.github.clientId,
|
|
||||||
client_secret: PROVIDERS.github.clientSecret,
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
Reference in New Issue
Block a user