gitlab icon indicating copy to clipboard operation
gitlab copied to clipboard

Oauth token gets 401 Unauthorized

Open luilver opened this issue 7 months ago • 0 comments

Following documentation for configuration example:

Gitlab.configure do |config|
  config.endpoint       = 'https://gitlab.com/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] and falls back to ENV['CI_API_V4_URL']
  config.private_token  = 'gloas-320086qEsq1pt6HJPaNciie3MG'       # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
end

I'm using an oauth2 token instead of a private one and either using private_token or auth_token I'm getting:

Gitlab::Error::Unauthorized (Server responded with code 401, message: 401 Unauthorized. Request URI: https://gitlab.com/api/v4/users)

What am I doing wrong?

luilver avatar May 22 '25 09:05 luilver