diff --git a/lib/util/http/auth.spec.ts b/lib/util/http/auth.spec.ts index 2854af307c1389bc55d1c2509e84c6c2af2b53cb..208a8209b67da11fa1267681c8a24595a37d9332 100644 --- a/lib/util/http/auth.spec.ts +++ b/lib/util/http/auth.spec.ts @@ -57,7 +57,7 @@ describe('util/http/auth', () => { expect(opts).toMatchInlineSnapshot(` { "headers": { - "authorization": "token XXXX", + "authorization": "Bearer XXXX", }, "hostType": "gitea", "token": "XXXX", diff --git a/lib/util/http/auth.ts b/lib/util/http/auth.ts index 99cc9bec817651f9ee1d400b05d313e7a4a3bc3d..0beec921d901c98fc6174b98be402ac138a10e34 100644 --- a/lib/util/http/auth.ts +++ b/lib/util/http/auth.ts @@ -40,7 +40,9 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>( options.hostType && GITEA_API_USING_HOST_TYPES.includes(options.hostType) ) { - options.headers.authorization = `token ${options.token}`; + // Gitea v1.8.0 and later support `Bearer` as alternate to `token` + // https://github.com/go-gitea/gitea/pull/5378 + options.headers.authorization = `Bearer ${options.token}`; } else if ( options.hostType && GITHUB_API_USING_HOST_TYPES.includes(options.hostType)