From 09ef6f9c852cc23d30ecea35ee6503c260aafe51 Mon Sep 17 00:00:00 2001 From: MasterEvarior Date: Wed, 28 Apr 2021 22:41:58 +0200 Subject: [PATCH] Authentication to Gitea now with header --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index ae7da2d..b8c8402 100644 --- a/src/index.js +++ b/src/index.js @@ -20,7 +20,7 @@ function toRepositoryList(repositories) { async function getGiteaUser(gitea) { return request.get(gitea.url + '/api/v1/user') - .query(`access_token=${gitea.token}`) + .set('Authorization', 'token ' + gitea.token) .then(response => { return { id: response.body.id, name: response.body.username } }); @@ -30,14 +30,14 @@ function isAlreadyMirroredOnGitea(repository, gitea, giteaUser) { const requestUrl = `${gitea.url}/api/v1/repos/${giteaUser.name}/${repository}`; return request.get( requestUrl) - .query(`access_token=${gitea.token}`) + .set('Authorization', 'token ' + gitea.token) .then(() => true) .catch(() => false); } function mirrorOnGitea(repository, gitea, giteaUser) { request.post(`${gitea.url}/api/v1/repos/migrate`) - .query(`access_token=${gitea.token}`) + .set('Authorization', 'token ' + gitea.token) .send({ clone_addr: repository.url, mirror: true,