Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51092

Two Factor Auth in Github Breaks Authentication for Github Organization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • None
    • Jenkins ver. 2.107.2
      GitHub Branch Source 2.3.3

      We are enforcing Two Factor Authentication on all users in our GitHub Organization.

      When we enabled it, all of our Jenkins jobs were fine EXCEPT for our "Github Organization" jobs.

      It seems this plugin only support username/password creds, not id_rsa or access_tokens, which work fine with Two Factor Authentication.

      If you use username/access_token credentials, you get access denied:

      Started by user 
      [Alex Gray|https://jenkins.clearcare.it/user/alex.gray]
      java.io.FileNotFoundException: 
      [https://api.github.com/]
      	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
      	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
      	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
      	at org.kohsuke.github.Requester.parse(Requester.java:612)
      	at org.kohsuke.github.Requester.parse(Requester.java:594)
      	at org.kohsuke.github.Requester._to(Requester.java:272)
      Caused: org.kohsuke.github.GHFileNotFoundException: \{"message":"Must specify two-factor authentication OTP code.","documentation_url":"
      [https://developer.github.com/v3/auth#working-with-two-factor-authentication]
      "}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:686)
      	at org.kohsuke.github.Requester._to(Requester.java:293)
      	at org.kohsuke.github.Requester.to(Requester.java:234)
      	at org.kohsuke.github.GitHub.checkApiUrlValidity(GitHub.java:703)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.checkApiUrlValidity(GitHubSCMSource.java:1348)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1401)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:564)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:95)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:295)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE
      

      Even the help text says it only supports username/password combos (image attached).

      The top of my config.xml file for this project is this:
      <jenkins.branch.OrganizationFolder plugin="branch-api@2.0.19">

      It looks like this has been fixed in other places, but not this plugin:
      https://issues.jenkins-ci.org/browse/JENKINS-39477

            Unassigned Unassigned
            grayaii Alex Gray
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: