From e112c260f0ca873291df26c9e68ed2e816ff0e94 Mon Sep 17 00:00:00 2001 From: netcon Date: Wed, 4 Dec 2024 21:10:48 +0800 Subject: [PATCH] fix: github/gitlab auth callback --- functions/api/github-auth-callback.ts | 2 +- functions/api/gitlab-auth-callback.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/api/github-auth-callback.ts b/functions/api/github-auth-callback.ts index ce9104fb9..34818e035 100644 --- a/functions/api/github-auth-callback.ts +++ b/functions/api/github-auth-callback.ts @@ -60,7 +60,7 @@ export const onRequest: PagesFunction<{ const response = await fetch('https://github.com/login/oauth/access_token', { method: 'POST', body: JSON.stringify({ client_id: env.GITHUB_OAUTH_ID, client_secret: env.GITHUB_OAUTH_SECRET, code }), - headers: { 'content-type': 'application/json' }, + headers: { accept: 'application/json', 'content-type': 'application/json' }, }); return response.json().then((result) => createResponse(response.status, result)); } catch (e) { diff --git a/functions/api/gitlab-auth-callback.ts b/functions/api/gitlab-auth-callback.ts index bf43a2505..46143f37d 100644 --- a/functions/api/gitlab-auth-callback.ts +++ b/functions/api/gitlab-auth-callback.ts @@ -68,7 +68,7 @@ export const onRequest: PagesFunction<{ redirect_uri: AUTH_REDIRECT_URI, grant_type: 'authorization_code', }), - headers: { 'content-type': 'application/json' }, + headers: { accept: 'application/json', 'content-type': 'application/json' }, }); return response.json().then((result) => createResponse(response.status, result)); } catch (e) {