From cd185ab3b03bcf4e2112a008070a2479a4432335 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Thu, 8 Nov 2018 14:59:04 +0100
Subject: [PATCH] fix: revert gitlab oauth (#2770)

---
 lib/config/definitions.js                 |  8 --------
 lib/platform/gitlab/gl-got-wrapper.js     |  8 --------
 lib/platform/gitlab/index.js              | 10 +++-------
 website/docs/self-hosted-configuration.md |  4 ----
 4 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index f0f0f9c68e..db7100df41 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -217,14 +217,6 @@ const options = [
     type: 'string',
     admin: true,
   },
-  {
-    name: 'oauth',
-    description: 'Whether token is of type Oauth or not',
-    stage: 'repository',
-    type: 'boolean',
-    default: false,
-    admin: true,
-  },
   {
     name: 'username',
     description: 'Username for authentication. Currently Bitbucket only',
diff --git a/lib/platform/gitlab/gl-got-wrapper.js b/lib/platform/gitlab/gl-got-wrapper.js
index 51903b17a2..e27f749ec6 100644
--- a/lib/platform/gitlab/gl-got-wrapper.js
+++ b/lib/platform/gitlab/gl-got-wrapper.js
@@ -15,14 +15,6 @@ async function get(path, options, retries = 5) {
   };
   const method = opts.method || 'get';
   const useCache = opts.useCache || true;
-  opts.headers = opts.headers || {};
-  // istanbul ignore if
-  if (opts.oauth) {
-    opts.headers.authorization = `Bearer ${opts.token}`;
-  } else {
-    opts.headers['PRIVATE-TOKEN'] = opts.token;
-  }
-  delete opts.token;
   if (method === 'get' && useCache && cache[path]) {
     logger.trace({ path }, 'Returning cached result');
     return cache[path];
diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js
index 18d844b4c8..a6922baf26 100644
--- a/lib/platform/gitlab/index.js
+++ b/lib/platform/gitlab/index.js
@@ -97,20 +97,16 @@ function cleanRepo() {
 async function initRepo({
   repository,
   token,
-  oauth,
   endpoint,
   gitAuthor,
   gitFs,
   localDir,
 }) {
-  const opts = hostRules.find(
-    { platform: 'gitlab' },
-    { token, endpoint, oauth }
-  );
+  const opts = hostRules.find({ platform: 'gitlab' }, { token, endpoint });
   if (!opts.token) {
     throw new Error(`No token found for GitLab repository ${repository}`);
   }
-  hostRules.update({ ...opts, platform: 'gitlab', default: true, oauth });
+  hostRules.update({ ...opts, platform: 'gitlab', default: true });
   config = {};
   get.reset();
   config.repository = urlEscape(repository);
@@ -148,7 +144,7 @@ async function initRepo({
       const { host } = URL.parse(opts.endpoint);
       const url = GitStorage.getUrl({
         gitFs,
-        auth: 'oauth2:' + (config.forkToken || opts.token),
+        auth: 'oauth2:' + opts.token,
         hostname: host || 'gitlab.com',
         repository,
       });
diff --git a/website/docs/self-hosted-configuration.md b/website/docs/self-hosted-configuration.md
index 996d197b65..ef536422bc 100644
--- a/website/docs/self-hosted-configuration.md
+++ b/website/docs/self-hosted-configuration.md
@@ -56,10 +56,6 @@ Set it to a string specifing the transport used by Git (`https`, `http` or `ssh`
 
 You probably have no need for this option - it is an experimental setting for the Renovate hosted GitHub App.
 
-## oauth
-
-Set this to true only if using an OAuth2 token from GitLab.
-
 ## onboarding
 
 Set this to `false` if (a) you configure Renovate entirely on the bot side (i.e. empty `renovate.json` in repositories) and (b) you wish to run Renovate on every repository the bot has access to, and (c) you wish to skip the onboarding PRs.
-- 
GitLab