Add GitLab as a social connection
You will learn the following:
- Use GitLab to authenticate users with OAuth
Before you start
Enabling OAuth with GitLab allows your users to sign up and sign in to your Clerk app with their GitLab account.
Configure for your development instance
For development instances, Clerk uses preconfigured shared OAuth credentials and redirect URIs—no other configuration is needed.
- In the Clerk Dashboard, navigate to the SSO Connections page.
- Select Add connection and select For all users.
- In the Choose provider dropdown, select GitLab.
- Select Add connection.
Configure for your production instance
For production instances, you must provide custom credentials which involves generating your own Client ID and Client Secret using your GitLab account.
To make the setup process easier, it's recommended to keep two browser tabs open: one for your Clerk Dashboard and one for your GitLab account.
Enable GitLab as a social connection in Clerk
- In the Clerk Dashboard, navigate to the SSO Connections page.
- Select Add connection and select For all users.
- In the Choose provider dropdown, select GitLab.
- Ensure that both Enable for sign-up and sign-in and Use custom credentials are toggled on.
- Save the Redirect URI somewhere secure. Keep the modal and page open.
Create a GitLab app
- In Gitlab, navigate to the Applications page.
- Select Add new application.
- Enter your app name in Name.
- In Redirect URI, paste the Redirect URI you saved from the Clerk Dashboard.
- Select the Scopes needed for your app. To allow users to sign up and sign in with GitLab, you must at least select
read_user
. - Select Save application. You'll be redirected to your app's settings page. Save the Application ID and Secret somewhere secure.
Set the Client ID and Client Secret in your Clerk Dashboard
- Navigate back to your Clerk Dashboard where the modal should still be open. Paste the Application ID and Secret values in the Client ID and Client Secret fields, respectively.
- Select Add connection.
Test your OAuth
The simplest way to test your OAuth is to visit your Clerk app's Account Portal, which is available for all Clerk apps out-of-the-box.
- In the Clerk Dashboard, navigate to the Account Portal page.
- Next to the Sign-in URL, select Visit. The URL should resemble:
- For development –
https://your-domain.accounts.dev/sign-in
- For production –
https://accounts.your-domain.com/sign-in
- Sign in with your GitLab account.
Feedback
Last updated on