/
Setup for GitHub Integration

Setup for GitHub Integration

Overview

This guide outlines the steps to configure OAuth2 authentication for the GitHub integration in your CDCM application.

This document will walk you through:

  1. Creating a GitHub OAuth App

  2. Configuring CDCM connection routing

  3. Testing the integration

By following these instructions, you'll enable your users to seamlessly connect their GitHub accounts and access their repositories within CDCM.

Create OAuth Application in Github

  1. Find Developer Settings: Locate the Developer settings link in the sidebar menu.

image-20240909-120511.png
  1. Access OAuth Apps: Navigate to the OAuth Apps section under the GitHub Apps menu.

  2. Create New OAuth App: Click the New OAuth App button to begin the process of registering a new OAuth application.

image-20240909-120609.png
  1. Configure OAuth App Details: Fill out the required fields:

  2. Register the Application: Click the Register application button to complete the process.

  3. Generate a new client secret: After the application is registered you get a client ID and can create a client secret. You will need both when you configure connection routing in cdcm.

Make sure to set the Authorization Callback URL correctly:

The format for the Authorization callback URL should be:

<your_cdcm_instance_url>/external-login/oauth2-redirect/<connection_id>

Where:

  • <your_cdcm_instance_url> is the root URL of your CDCM instance (e.g., https://your.cdcm.instance.com)

  • <connection_id> is a unique identifier for the connection between your CDCM app and the GitHub OAuth app (e.g., cdcm-github)

The external-login/oauth2-redirect/ part of the URL is a predefined path that your CDCM application is expecting the GitHub OAuth flow to redirect to after a successful authentication.

Connection Routing

After the oauth application was registered in github the connection routing configuration yml can be updated.

  • Add a new section under connection-routing the cdcm-connection-id value has to be the same that was used as part of the authorization callback url above.

- cdcm-connection-id: cdcm-github methods: ALL root-uris: - https://api.github.com/**
  • Add a new section under connections. Use the client-id and client-secret from the oauth app registered in GitHub.

cdcm-github: connection-type: OAUTH20 client-id: dGhpcyBpcyBhIGlk client-secret: SGVsbG8gZnJpZW5kIDop user-info-uri: https://api.github.com/user scopes: read:user, repo authorization-uri: https://github.com/login/oauth/authorize token-uri: https://github.com/login/oauth/access_token