From 029e11d785522124950164d78b7215bab604a393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=A4fer?= Date: Thu, 1 Aug 2024 15:33:22 +0200 Subject: [PATCH] Change `Authorization` header type for API requests from "token" to "Bearer" (#7242) The authorization type "Bearer" is more widely recognized than "token". E.g. Gitlab requires that you use "Bearer". This should fix #7172 where apparently login with Github was broken by this line: https://github.com/decaporg/decap-cms/issues/7172#issuecomment-2184138768 See also: https://github.com/decaporg/decap-cms/pull/5844#discussion_r1658974332 --- packages/decap-cms-lib-util/src/API.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/decap-cms-lib-util/src/API.ts b/packages/decap-cms-lib-util/src/API.ts index 277f045d3603..1a6663807c17 100644 --- a/packages/decap-cms-lib-util/src/API.ts +++ b/packages/decap-cms-lib-util/src/API.ts @@ -182,7 +182,7 @@ async function constructRequestHeaders(headerConfig: HeaderConfig) { const { token, headers } = headerConfig; const baseHeaders: HeaderObj = { 'Content-Type': 'application/json; charset=utf-8', ...headers }; if (token) { - baseHeaders['Authorization'] = `token ${token}`; + baseHeaders['Authorization'] = `Bearer ${token}`; } return Promise.resolve(baseHeaders); }