Table of Contents
GitLab OAuth Application Setup
Phase: 1 - Prerequisites & Secrets
Duration: 10-15 minutes
Purpose: Create GitLab OAuth application for ArgoCD authentication
Overview
ArgoCD requires a GitLab OAuth application to enable GitLab-based authentication. This guide walks through creating the OAuth application in GitLab and recording the credentials for Terraform.
📋 Prerequisites
- GitLab account with appropriate permissions
- Access to GitLab profile settings
- Knowledge of your ArgoCD domain (e.g.,
argocd.florenciacomuzzi.com
)
🔧 Setup Steps
Step 1: Access GitLab Applications
- Login to GitLab
- Go to GitLab.com or your GitLab instance
-
Sign in with your account
-
Navigate to Applications
- Click on your profile picture (top right)
- Select "Edit Profile"
- In the left sidebar, click "Applications"
Step 2: Create OAuth Application
- Application Details
-
Name:
Argo CD - Blueberry [Environment]
- Use
Blueberry Development
for dev environment - Use
Blueberry Production
for prod environment
- Use
-
Redirect URIs (Add both):
https://argocd.florenciacomuzzi.com/auth/callback https://argocd.florenciacomuzzi.com/api/dex/callback
Note: Replace
argocd.florenciacomuzzi.com
with your actual ArgoCD domain
- Scopes (Select these checkboxes):
- ✅
openid
- ✅
profile
- ✅
email
-
✅
read_api
-
Confidentiality
- ✅ Check "Confidential" (should be default)
Step 3: Save Application
- Click "Save Application"
- Record the Credentials:
- Application ID: Copy this value (not secret)
- Secret: Copy this value (sensitive - handle with care)
📝 Configuration Records
After creating the application, you'll need to record these values:
For Terraform Variables
Add to your blueberry-terraform/.env
file:
# GitLab OAuth Application (for ArgoCD)
TF_VAR_gitlab_oauth_client_id="your-application-id-here"
TF_VAR_gitlab_oauth_client_secret="your-secret-here"
For Terraform tfvars
Add to your blueberry-terraform/variables/dev.auto.tfvars
file:
# GitLab OAuth Application (created manually in GitLab UI)
gitlab_oauth_client_id = "your-application-id-here"
# gitlab_oauth_client_secret should be set via TF_VAR_gitlab_oauth_client_secret in .env file
🔒 Security Considerations
- Secret Protection
- Never commit the client secret to version control
- Store the secret in environment variables only
-
Use different OAuth apps for different environments
-
Scope Limitations
- Only grant minimal required scopes
read_api
is needed for group membership validation-
Other scopes are for basic profile information
-
Redirect URI Validation
- Ensure redirect URIs match your actual ArgoCD domain
- GitLab validates these URIs for security
✅ Verification
After setup, verify the configuration:
- Check Application List
- Return to GitLab Applications page
- Verify your application is listed
-
Note the Application ID matches your records
-
Test Redirect URIs
- Ensure ArgoCD domain is correct
- Both callback URLs should be identical except for the path
🚨 Common Issues
Issue: "Invalid redirect URI"
Cause: Redirect URI doesn't match exactly
Solution: Verify the ArgoCD domain and ensure both callback URLs are added
Issue: "Scope not granted"
Cause: Required scopes not selected
Solution: Edit the application and ensure all 4 scopes are checked
Issue: "Application not found"
Cause: Application ID copied incorrectly
Solution: Double-check the Application ID from GitLab
📚 Additional Resources
⏭️ Next Steps
Once you have the GitLab OAuth application configured:
- Record the credentials in your
.env
file - Continue with Slack Webhook Setup
- Complete all prerequisites before proceeding to Phase 2
Related: Phase 1 Overview | Secrets Checklist