Connecting GitLab to Airbyte Using OAuth 2.0

Steps Followed

1. Create an OAuth Application in GitLab


2. Generate Authorization Code

Paste this URL in your browser (replace placeholders accordingly):

https://gitlab.example.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code&scope=api

Example:

https://gitlab.example.com/oauth/authorize?client_id=c4505a79...eca13&redirect_uri=http://localhost:8000/workspaces/123/connections&response_type=code&scope=api

3. Exchange Code for Access & Refresh Token

Use this curl command in your terminal (replace placeholders):

curl --location 'https://gitlab.example.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
--data-urlencode 'code=YOUR_AUTHORIZATION_CODE' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=YOUR_REDIRECT_URI'

You will receive a JSON response containing refresh_token, access_token, and token_expiry. Save these values.


4. Configure Airbyte Source

In Airbyte:

  1. Choose GitLab as the source.
  2. Set the Authorization Method to OAuth2.0.
  3. Fill in the following fields:
    • access_token: the token from Step 3
    • refresh_token: the refresh token from Step 3
    • client_id: your GitLab OAuth app client ID
    • client_secret: your GitLab OAuth app client secret
    • token_expiry_date: the expiry timestamp from the API response
    • API URL: https://gitlab.example.com/api/v4
    • Optional: group/project IDs to scope the connection
  4. Click Test the source to verify the connection.
A.M. Rinas

Written by A.M. Rinas

Full-Stack Software Engineer working on web applications, DevOps automation, and databases. More about me on the about page, or say hi through the contact page and LinkedIn.

← Back to all articles