Jenkins GitHub OAuth Plugin (GitHub Authentication plugin)

Why: Use GitHub user credentials to administer Jenkins instance, using GitHub OAuth Application.

Plug-in details: https://plugins.jenkins.io/github-oauth

Configuration (Github): Step1: https://github.com → Settings → Developer Settings → New OAuth Apps → New OAuth App.

  • Application Name: Jenkins
  • HomePageURL: Your Jenkins landing page URL, for me it is https://jenkis..ninja
  • Application Description: Whatever you like
  • Authorization callback: <JENKINS_URL>:<JENKINS_PORT>/securityRealm/finishLogin please make sure your spellings are correct

Add your application

Step 2: Configuration (Jenkins)

  • Enable security checkbox
  • Access Control checkbox
  • Github Authentication plugin
  • Github Web URI: https://github.com or your own Github server instance
  • Client Id: which will you get from Github
  • Client Secret: Secret key that you will get from GitHub while Adding Jenkins as application
  • OAuth Scope(s): read:org,user:email,repo

Then Authorization:

  • Matrix-based Security: checkbox check as checked-in screenshot

For more details please read https://plugins.jenkins.io/github-oauth/

Answer from Dupinder Singh on Stack Overflow
🌐
Jenkins
jenkins.io › blog › 2020 › 04 › 16 › github-app-authentication
GitHub App authentication support released
Access to GitHub Checks API - GitHub Apps can access the GitHub Checks API to create check runs and check suites from Jenkins jobs and provide detailed feedback on commits as well as code annotation · Install the GitHub Branch Source plugin, make sure the version is 2.7.1 or above. Follow the GitHub App Authentication setup guide.
🌐
CloudBees
docs.cloudbees.com › documentation › use github app authentication
Use GitHub App authentication
For Shared secret, select Add and choose Jenkins. For Kind, select Secret text. Enter the webhook secret you added to the GitHub App in Create the GitHub App. Select Add. By default, CloudBees CI tries to be parsimonious with GitHub API usage since the rate limit can easily be exceeded when ...
Discussions

Configuring Jenkins with GitHub (Authorization) - Stack Overflow
I am using Jenkins 2.223 and GitHub Authentiction Plugin 0.33. ... Why: Use GitHub user credentials to administer Jenkins instance, using GitHub OAuth Application. More on stackoverflow.com
🌐 stackoverflow.com
How to Configure GitHub App Authentication in Jenkins Pipeline Script for Secure Repository Access - Stack Overflow
How can I configure my Jenkins pipeline to authenticate with GitHub using a GitHub App at the organization level, enabling it to push changes and manage repository access? Specifically, what steps ... More on stackoverflow.com
🌐 stackoverflow.com
Github Application Credentials
Hello, I have a question regarding Github Application Credentials. Whenever I search for how it can be used, it seems to be limited to Organization Folders and multibranch pipelines. I would like to use it in a declarative pipeline script that is used interactively - so no automatic code scanning ... More on community.jenkins.io
🌐 community.jenkins.io
2
0
November 13, 2023
Using GitHub app authentication for our Jenkins
Hi, Currently, our Jenkins is using personal credentials to access jetty org repos. To avoid using too much of the GH rate limit of a single user. See documentation here: https://github.com/jenkins... More on github.com
🌐 github.com
13
November 7, 2023
🌐
Jenkins
plugins.jenkins.io › GitHub-Oauth
GitHub Authentication | Jenkins plugin
January 19, 2026 - The GitHub Authentication plugin provides a means of securing a Jenkins instance by offloading authentication and authorization to GitHub. The plugin authenticates by using a GitHub OAuth Application.
🌐
Roger
roger.ml › p › jenkins-ci-github-app-authentication
How to authenticate with GitHub on Jenkins CI using a GitHub App
April 25, 2023 - After creating the GitHub App, you will need to generate a private key to authenticate to the GitHub App. Simply click in “Generate a Private Key” button. After you have generating and downloading the private key, you’ll need to convert ...
🌐
Stack Overflow
stackoverflow.com › questions › 79154379 › how-to-configure-github-app-authentication-in-jenkins-pipeline-script-for-secure
How to Configure GitHub App Authentication in Jenkins Pipeline Script for Secure Repository Access - Stack Overflow
I have configured the GitHub App in Organization and personal account with the below permissions. Administration: Read-only Checks: Read & write Contents: Read-only (to read the Jenkinsfile and the repository content during git fetch). Metadata: Read-only Pull requests: Read-only · stage('Generate JWT and Clone Repository') { environment { // Hardcoded Credentials and Repository Information APP_ID = "asdfadsfasdf" // Replace with your GitHub App ID INSTALLATION_ID = "1234567" // Replace with your GitHub App Installation ID PEM_CONTENT = ''' -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE
Find elsewhere
🌐
Jenkins
community.jenkins.io › using jenkins
Github Application Credentials - Using Jenkins - Jenkins
November 13, 2023 - Hello, I have a question regarding Github Application Credentials. Whenever I search for how it can be used, it seems to be limited to Organization Folders and multibranch pipelines. I would like to use it in a declarative pipeline script that is used interactively - so no automatic code scanning ...
🌐
GitHub
github.com › jetty › .eclipsefdn › issues › 32
Using GitHub app authentication for our Jenkins · Issue #32 · jetty/.eclipsefdn
November 7, 2023 - Hi, Currently, our Jenkins is using personal credentials to access jetty org repos. To avoid using too much of the GH rate limit of a single user. See documentation here: https://github.com/jenkinsci/github-branch-source-plugin/blob/master/docs/github-app.adoc
Author   olamy
🌐
Medium
medium.com › @xgro › guide-to-integrating-jenkins-with-github-oauth-3c479c639896
Guide to Integrating Jenkins with GitHub OAuth | by Jaechan Lee | Medium
February 26, 2024 - Go to Manage Jenkins > Security. In the Security Realm section, select GitHub Authentication Plugin.
🌐
GitHub
github.com › primetheus › jenkins-github-app-library
GitHub - primetheus/jenkins-github-app-library: Jenkins Shared Library to authenticate as a GitHub App via JWT
July 11, 2023 - If you use the GitHub Authentication plugin along with this library you can get a temporary Personal Access Token for yourself. @Library('primetheus-gitub-app') echo getBuildUser() @Library('primetheus-github-app') echo getAccessToken()
Author   primetheus
Top answer
1 of 4
1

Check first if you have the github-oauth Jenkins plugin installed, as described in "Use the Jenkins OAuth plug-in to securely pull from GitHub", from Walker Rowe.

That would allow to register your Jenkins server as an application which can then access GitHub resources:

2 of 4
1

Another approach is to take advantage of the GitHub App authentication support

It is released in April 2020 with GitHub Branch Source 2.7.0-beta1 which is available in the Jenkins experimental update center.

Why authenticate as a GitHub app?

  • Larger rate limits - The rate limit for a GitHub app scales with your organization size, whereas a user based token has a limit of 5000 regardless of how many repositories you have.
  • User-independent authentication - Each GitHub app has its own user-independent authentication.
    No more need for 'bot' users or figuring out who should be the owner of 2FA or OAuth tokens.
  • Improved security and tighter permissions - GitHub Apps offer much finer-grained permissions compared to a service user and its personal access tokens.
    This lets the Jenkins GitHub app require a much smaller set of privileges to run properly.
  • Access to GitHub Checks API - GitHub Apps can access the the GitHub Checks API to create check runs and check suites from Jenkins jobs and provide detailed feedback on commits as well as code annotation

And:

In addition to usage of GitHub App authentication for Multi-Branch Pipeline, you can also use app authentication directly in your Pipelines.

You can access the Bearer token for the GitHub API by just loading a 'Username/Password' credential as usual, the plugin will handle authenticating with GitHub in the background.

🌐
GitHub
github.com › jenkinsci › github-oauth-plugin
GitHub - jenkinsci/github-oauth-plugin: Jenkins authentication plugin using GitHub OAuth as the source. · GitHub
The GitHub Authentication plugin provides a means of securing a Jenkins instance by offloading authentication and authorization to GitHub. The plugin authenticates by using a GitHub OAuth Application.
Starred by 104 users
Forked by 162 users
Languages   Java 97.0% | HTML 3.0%
Top answer
1 of 1
1

You can accomplish this by using a GitHub App and its "client secret." To do this, you need to have admin rights in the GitHub Organization.

  1. Go to the GitHub Organization settings - URL is like https://github.com/organizations/MyOrganization/settings/apps

  2. Click the button to create a New GitHub App.

  3. Fill out the required data for the app Name and URL (I just used the Organization page URL).

  4. Un-check the Webhook > Active option.

  5. In the Repository Permissions section, I selected the following:

    1. Actions: Read & Write

    2. Commit Status: Read & Write

    3. Contents: Read-only

    4. Packages: Read & Write (some of our jobs publish artifacts to GitHub Packages, yours may not need this).

    5. Pull Requests: Read-only

  6. Click the button to Create GitHub App.

  7. Back on the App page, click the button to Generate a new client secret.

    1. Copy the generated secret NOW, it won't be visible later.
  8. Also take note of the App ID (as of now, a 7-digit number).

  9. Click the Install App link (left-side navigation), then install the app into your Organization account.

Back in Jenkins...

Now that you have the App ID and Client Secret, go to your Jenkins server and navigate to the Credentials page (Manage Jenkins > Credentials).

  1. Click the Scope and Domain (System by default) and Domain ("global" by default) for the new credential, then Add Credentials.

  2. On the New Credentials form, select GitHub App as the Kind.

  3. For ID, leave it blank or make one up. This is NOT the GitHub App ID, this is the Jenkins credential ID and it will be generated if you don't enter one.

  4. For App ID, enter the App ID you noted in step 8 above.

  5. For Key, you'll use the client secret you copied in step 7.1 above.

    1. Make sure to click the help link (? icon) next to the Key label to get instructions for converting the secret into the right format.
  6. Click the Test Connection button to make sure you copy/pasted everything correctly.

  7. Click the Create button to add this credential.

This credential can now be selected for use in the Source Code Management of your Jenkins builds.

🌐
Jenkins
jenkins.io › solutions › github
Jenkins with GitHub
Using the GitHub Authentication plugin it is possible to use GitHub’s own authentication scheme for implementing authentication in your Jenkins controller.
🌐
TheServerSide
theserverside.com › tutorial › Use-the-Jenkins-OAuth-plug-in-to-securely-pull-from-GitHub
Use the Jenkins OAuth plug-in to securely pull from GitHub | TheServerSide
... GitHub is used by many organizations as a source code repository. The easiest way to securely authenticate with GitHub through Jenkins is to use the Jenkins OAuth plug-in for GitHub.
🌐
CD Foundation
cd.foundation › home › from jenkins – github app authentication support released
From Jenkins – GitHub App authentication support released - CD Foundation
November 1, 2023 - User-independent authentication – Each GitHub app has its own user-independent authentication. No more need for ‘bot’ users or figuring out who should be the owner of 2FA or OAuth tokens. Improved security and tighter permissions – GitHub Apps offer much finer-grained permissions compared to a service user and its personal access tokens. This lets the Jenkins GitHub app require a much smaller set of privileges to run properly.
🌐
Medium
tanulb.medium.com › secure-integration-between-jenkins-and-github-aa5ca463e6c3
Secure integration between Jenkins and Github | by Tanul | Medium
February 15, 2021 - Now, github will create the hash signature and append this in the header “X-Hub-Signature” of each webhook payload. For more details refer this link In Jenkins, we shall validate this hash signature to filter the incoming webhook requests using the same secret key.
🌐
Servers for Hackers
serversforhackers.com › c › github-authentication-authorization
Github Authentication & Authorization | Servers for Hackers
Head to Manage Jenkins > Configure Global Security. Under Security Realm, choose "Github Authentication Plugin" Head to GitHub.com and create an application under the organization (shipping-docker for me) we'll use to authenticate against.
Published   April 16, 2017