How to mitigate changes to GitLab version 15.0 support for OAuth tokens

In GitLab version 15.0, support for OAuth tokens with no expiration date was removed (gitlab issue). This meant that using our Git Gateway service started to have a 2-hour time limit when configured with GitLab and OAuth. This was a breaking change for many of our users.

You can mitigate this problem by using a Personal Access Token. The steps are:

  • log into the GitLab UI and generate a token (User Settings > Access Tokens)
  • create the token with the scopes you need. For NetlifyCMS users those are: api, read_api, read_repository, & write_repository
  • copy & save that value to the Netlify UI: Site settings > Identity > Git Gateway

We are going to be evaluating using OAuth and refresh tokens with GitLab in the near future.

3 Likes

Thank you so much for this! You can also create/use access tokens from the gitlab repo (instead of a user account);

  • Gitlab repo > Settings > Access tokens
1 Like

Thanks for chiming in and adding this, @Loque! We appreciate it!

Happy building :rocket:

Just a note that project access tokens are not available on the free SaaS tier.

You can use project access tokens:

  • On GitLab SaaS if you have the Premium license tier or higher. Project access tokens are not available with a trial license.
  • On self-managed instances of GitLab, with any license tier.
2 Likes