How to extend expiration of access tokens

I am hosting a small instance of gitlab community 16.11. Suddenly all of my access tokens are expiring in a few days, and I cannot create new access tokens without an expiration date of at most a year.

Please advise how to create access tokens that do not expire.

Gitlab in one of their upgrades set all access tokens to expire within one year. It is no longer possible to create access tokens without an expiry date. The maximum amount of time a token can work is 1 year, and then it will expire.

Thanks for your quick reply.

What is the purpose of maintaining my own gitlab server if I don’t have control over settings like this?

What is the workable solution for small businesses like mine to manage client-side access to the server that doesn’t require regular maintenance?

Good question, I also cannot change it on my instances either. It was forced by Gitlab for security reasons. I personally don’t agree that the functionality should be forced upon me, but it’s not my product. If I choose to use it, I have to abide by the decisions made when the application is developed.

In reality, changing/updating tokens once a year isn’t a hardship. If you don’t like it you can always migrate away from Gitlab to something else. They won’t be changing it back to how it was, otherwise they would have given us the choice to decide for ourselves if we want to use non-expiring tokens when they decided to do what they did.

Either live with the tokens expiring and generate new ones every year, or migrate away to something else - you can probably find alternatives with google.

You can automate the token extension using the script:

2 Likes

I had the same issue as @tk421storm, but I found that you can turn the expiration requirement off if you have administrator privileges. It wasn’t really obvious that this was possible, at least when googling on this issue.

I am running GitLab 17.4 EE Free version. So there may be a difference in feature sets to the CE edition, I suppose.

I’m really glad I found that token expiration could be turned off. Really inconvenient otherwise, when using access tokens for automation purposes.

Hope this helped someone! :slight_smile:

Something they introduced in Gitlab 17.3. In 17.2 documentation and earlier that option didn’t exist. It seems they decided to allow us to decide after all if we want token expiry or not :slight_smile:

1 Like

wow that’s amazing! Exactly what I was looking for. I would love to see the discussion that lead to that, when I looked it up previously they were pretty firm about never allowing the option again.

Hi all,

I just publish my solution regarding this and might enhance your security related to Access Token management.

Have a look

1 Like