I had a Jenkins system all set up with authentication via GitHub OAuth, but today it suddenly stopped working. Whenever Jenkins attempts to authenticate a user, GitHub redirects back to
http://jenkins.mycompany.com:8080/securityRealm/finishLogin?code=... and throws an exception:
java.io.FileNotFoundException: https://api.github.com/user/orgs
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.kohsuke.github.Requester.parse(Requester.java:298)
...
To convince myself I hadn't messed something up in my Jenkins config, I spun up a fresh Ubuntu 12.04 server, installed Jenkins 1.541 from the
jenkins-ci.org apt repository, and installed the github-api (1.44) and github-oauth (0.14) plugins.
I then set up the GitHub Authentication Plugin Security Realm with the Client ID and Client Secret from my GitHub application. I left the Web URI and API URI at their default values.
On this new server the result is exactly the same.
I do notice that the authorization scope GitHub is using is the default one for public read-only access (includes public user profile info, public repo info, and gists). So it makes sense that the /user/orgs query fails.
What's not clear is whether (1) Jenkins should be requesting a broader authorization scope, (2) GitHub should be returning a broader authorization scope, (3) Jenkins shouldn't even be attempting to enumerate /user/orgs, or (4) something else.
Any clues what the problem might be? Could this have something to do with it?