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).
- In the upper-right corner, select your avatar and choose Edit profile.
- In the left sidebar, select Access > Applications, then Add new application.
- 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. - Select the OAuth 2 scopes the connection needs — see the per-capability scopes in this catalog entry (
read_usersuffices for identity-only access;apigrants complete read/write API access). - 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/authorizeand the code exchange athttps://<host>/oauth/token. On GitLab Self-Managed or Dedicated, replacegitlab.comwith 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 sendclient_secretas 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.
Connect it to Publicus
Section titled “Connect it to Publicus”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.