Skip to content
Docs

Creating a GitLab OAuth 2.0 application

This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.

Distilled from GitLab’s own documentation: Configure GitLab as an OAuth 2.0 authentication identity provider and OAuth 2.0 identity provider API. Retrieved 2026-07-03.

These steps create a user-owned application. The same form exists group-owned (group → Settings → Applications) and instance-wide (self-managed administrators: Admin area → Applications → New application; an instance-wide application marked trusted skips the user authorization step).

  1. In the upper-right corner, select your avatar and choose Edit profile.
  2. In the left sidebar, select Access > Applications, then Add new application.
  3. Enter a Name and enter the callback URL from the connect form as the Redirect URI. GitLab expects an SSL (https://) redirect URI; non-SSL URIs are allowed but discouraged outside development.
  4. Select the OAuth 2 scopes the connection needs — see the per-capability scopes in this catalog entry (read_user suffices for identity-only access; api grants complete read/write API access).
  5. Select Save application, then record the Application ID (the client ID) and copy the Secret with the Copy button. GitLab stores application secrets hashed — the secret is only available immediately after creation; use Renew secret to generate a new one if it is lost.

Operational notes (from docs.gitlab.com/api/oauth2 and docs.gitlab.com/integration/oauth_provider):

  • Authorization happens at https://<host>/oauth/authorize and the code exchange at https://<host>/oauth/token. On GitLab Self-Managed or Dedicated, replace gitlab.com with the instance host — the endpoints are identical on every instance.
  • PKCE (code_challenge_method=S256) is supported and lets public clients complete the exchange without the client secret; confidential clients send client_secret as a form-body parameter.
  • By default, access tokens expire after two hours (7200 seconds). A refresh invalidates both the existing access token and refresh token and returns new ones — store the new refresh token after every refresh.
  • Deleting the application deletes all grants and tokens associated with it.

Open Connections under Credentials, choose GitLab, and pick GitLab OAuth 2.0. Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.

See also: GitLab in the catalog.

This guide is maintained by Publicus and published under CC BY 4.0.