---
title: "How to manage the lifetime limit of GitLab access tokens?"
description: "From May 2024 GitLab stopped supporting access tokens with no expiry date, so the token we had been using since 2018 stopped working and created a serious problem in our plugins for WordPress and in our plugins for WooCommerce that"
url: https://artprojectgroup.com/how-to-manage-the-lifetime-limit-of-gitlab-access-tokens
date: 2024-08-14
modified: 2025-05-30
author: "Art Project Group"
image: https://artprojectgroup.com/wp-content/uploads/2023/02/programacion-web-blog.webp
categories: ["Tutorials"]
tags: ["GitLab", "PHP", "Web programming"]
type: post
lang: en-US
---

# How to manage the lifetime limit of GitLab access tokens?

From May 2024 GitLab stopped supporting access tokens with no expiry date, so the token we had been using since 2018 stopped working and created a serious problem in our plugins for WordPress and in our plugins for WooCommerce that manage their updates from our private repository, since they stopped connecting with the old access token and they do not do so by making the repository public either.

The problem is that we cannot leave a token configured in the code of the plugin that is going to end up disappearing within a maximum period of 365, so we have had to build a small piece of PHP code that takes care of regenerating the lifetime of the new access token using the [GitLab rotation API](https://docs.gitlab.com/ee/api/personal_access_tokens.html#rotate-a-personal-access-token).

### How have we solved it?

On our website we have created a scheduled event that runs every six months, since, as we have verified, the rotation generates a maximum date of eleven months despite telling it one year. The PHP code we have had to build is very similar to this one:

Copy to clipboardSyntax Highlighter
