Skip to content

Can not get `Bearer` access token using `/oauth/token` endpoint with GitLab 13.9.0

Summary

It is not possible to obtain Bearer access token anymore using /oauth/token endpoint. It stopped working starting from GitLab 13.9.0, with version 13.8.4 everything works fine.

Steps to reproduce

  1. Install GitLab 13.9.0 from scratch a default way.
  2. Set password for root to password.
  3. Invoke the following commands:
echo 'grant_type=password&username=root&password=password' > auth.txt
curl --data "@auth.txt" --request POST 'http://localhost:8888/oauth/token'

GitLab 13.9.0 responds with:

{"error":"invalid_client","error_description":"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."}

All earlier GitLab versions respond differently:

{"access_token":"8b91ace96c881586df9565cbfd954bb31398cffc6205098ee88607c16f856fa0","token_type":"Bearer","refresh_token":"beaf7b154836cc497160e2ac334399047184892e0cadac2ff4f34913292837c0","scope":"api","created_at":1614089741}

Only the following adjustments in the configuration were done:

external_url 'http://localhost:8888'
gitlab_rails['initial_root_password'] = "password"
gitlab_rails['initial_shared_runners_registration_token'] = "token"
sidekiq['concurrency'] = 2
unicorn['worker_processes'] = 2
puma['worker_processes'] = 2
puma['enable'] = true
unicorn['enable'] = false
prometheus_monitoring['enable'] = false
grafana['enable'] = false
postgresql['shared_buffers'] = '1MB'

Example Project

-

What is the current bug behavior?

/oauth/token endpoint is not usable anymore for obtaining Bearer access tokens.

What is the expected correct behavior?

/oauth/token endpoint should be suitable for obtaining Bearer access tokens, as with earlier GitLab versions.

Relevant logs and/or screenshots

-

Output of checks

-

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.7.2p137
Gem Version:    3.1.4
Bundler Version:2.1.4
Rake Version:   13.0.3
Redis Version:  6.0.10
Git Version:    2.29.0
Sidekiq Version:5.2.9
Go Version:     unknown

GitLab information
Version:        13.9.0
Revision:       f1bc6c9f752
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     12.5
URL:            http://localhost:8888
HTTP Clone URL: http://localhost:8888/some-group/some-project.git
SSH Clone URL:  git@localhost:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        13.16.1
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell
Git:            /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.16.1 ? ... OK (13.16.1) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... can't check, you have no projects Redis version >= 4.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.29.0 ? ... yes (2.29.0) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

-

Edited by Alexander Kutelev