Created Personal access tokens not listed and not usable

:hugs: Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.

Problem to solve

In the Personal access tokens view, the message “An error occurred while fetching the tokens.” is displayed.
And the tokens created are not listed.
How can i fix this?

Steps to reproduce

The error is displayed again and again when i call up the website.

Configuration

Versions

Please add an x whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated

Versions

  • GitLab 18.1
4 Likes

I’ having the same error when trying to create access token, the notice shows “An error occurred while creating the token.” This error only happened since I updated to version gitlab-ce:18.1.2-ce.0

2 Likes

Having the same issue after upgraded to 18.2.0

2 Likes

Same here, after upgrading to 18.2.0

Getting to 18.2.1 didn’t solve it either

1 Like

v18.2.1 clean install in docker, still open

same here

you can create tokens from the console

user = User.find_by_username("xxx")

max_expiry = Date.today + 365

token = user.personal_access_tokens.create!(
  name: "xyz",
  scopes: [:api],
  expires_at: max_expiry
)

puts "Access Token: #{token.token}"
puts "Expires at: #{token.expires_at}"

This info may or may not be useful for your use case, but… setting external_url to use https:// instead of http:// solved the problem.

I regularly upgrade gitlab instances and somewhere inbetween minor upgrades to v18 I run into the same issue on one of my gitlab servers.
The server is behind a reverse proxy, and external_url was set to be http:// and redirection to https:// done on proxy.

Turns out setting external_url to use “https://” needs other step to be done - explicitly disabling https in configuration because gitlab wants to engage in certificate management otherwise and reconfiguration step fails.
So, it is also necessary to set

nginx['listen_port'] = 80
nginx['listen_https'] = false

then you can use external_url with https. Reference.
Once this was done, I was again able to retrieve tokens and create new ones.

5 Likes

Thank you! In our case your solution solves the problem with a tokens.

Thank you, this has also resolved this issue for me!

Thank you for pointing me in the right direction! It solved my issues with my GitLab CE docker container.

I wrote up a quick post on my blog to summarize how I got it to work on Synology.