Skip to content

Instantly share code, notes, and snippets.

@ryanj
Last active January 12, 2024 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanj/d7d18b922c71bd64da3d695d179006bc to your computer and use it in GitHub Desktop.
Save ryanj/d7d18b922c71bd64da3d695d179006bc to your computer and use it in GitHub Desktop.
# Set up GitHub authentication for Backstage
## Sign in to GitHub
Sign in to https://github.com/ or create a new account.
Warning: about single user mode
## Set up a User Access Token
Visit https://github.com/settings/tokens/new to generate a new "classic" token.
Select the "Repo" checkbox to enable "Full control of private repositories", then click "Generate Token".
Save your resulting personal access token for later use: ghp_j4WmPqZMPsdHnGyWGlIkuz0T1eyybO47udUt
## Register new GitHub App
Visit https://github.com/settings/apps/new to register a new GitHub App.
1. Enter "rhdh-sandbox" into the GitHub App name input.
2. Enter your rhdh application route url in the Homepage URL input.
3. In the Callback URL input, enter your rhdh application url plus "/api/auth/github/handler/frame"
4. Deactivate webhooks
5. Click on the "Create GitHub App" button at the bottom of the page
Note the resulting "Client ID", then click on the "Generate New Client Secret" button.
## Update your ConfigMap
1. Return to your Sandbox environment and select `ConfigMaps` from the side nav menu or from the Search interface
2. Select `app-config-rhdh` to open your backstage config
3. Select the YAML tab
4. Update the ConfigMap as follows, while inserting your own custom configuration details in place of the variables:
```
kind: ConfigMap
apiVersion: v1
metadata:
name: app-config-rhdh
data:
app-config-rhdh.yaml: |
app:
title: Red Hat Developer Hub
baseUrl: ${RHDH_HTTPS_ROUTE_URL}
integrations:
github:
- host: github.com
token: ${GITHUB_USER_ACCESS_TOKEN}
auth:
allowGuestAccess: true
environment: development
providers:
github:
development:
clientId: ${GITHUB_APP_CLIENT_ID}
clientSecret: ${GITHUB_APP_CLIENT_SECRET}
enabled:
github: true
```
Save the ConfigMap, then open the developer-hub deployment from the topology page. Scale the deployment down to zero, then back up to one to load the new ConfigMap data.
Return to Red Hat Developer Hub to log in using your Github account.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment