bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
455 stars 98 forks source link

Enterprise: Open Gist in Editor fails #37

Closed jasonpincin closed 11 years ago

jasonpincin commented 11 years ago

When attempting to open a (public or private) Gist in GitHub enterprise, the HTML content of the login page is loaded into Sublime instead of the content of the gist. This Github Enterprise install is using LDAP authentication, in case it matters. The API key was generated properly and all other functions of the plugin appear to work.

bgreenlee commented 11 years ago

Hmm. I'm using it with GitHub Enterprise here at Etsy and it's working fine. Is there something about your install that doesn't allow token-only requests?

jasonpincin commented 11 years ago

It's odd, like I said, everything else in the plugin works fine (I can create gists just fine with the plugin!). I've been fiddling with it for the past hour seeing if I can figure it out. Everything going through the /api/v3 base works fine, but the raw gist base is /gist/raw, and it just throws back the login page. There's not a whole log of config options with Enterprise, I've been all through the admin console looking for something that would affect this...

bgreenlee commented 11 years ago

Could you put "debug": true in your settings file (Preferences->Package Settings->GitHub->Settings - User, and then tell me if there's anything useful in the Sublime console?

jasonpincin commented 11 years ago

Sure, here's the relevant output:

2013-01-11 17:35:49,868 request: get http://git.XXXXX.local/api/v3/gists {'Authorization': u'token 751d6a0ae34b262a9f0dba9406c6db09b49803b4'} {'per_page': 100, 'page': 1}
2013-01-11T17:35:49.868959   GET   http://git.XXXXXX.local/api/v3/gists?per_page=100&page=1
2013-01-11 17:35:49,869 Starting new HTTP connection (1): git.www.euro-pro.local
2013-01-11 17:35:49,976 "GET /api/v3/gists?per_page=100&page=1 HTTP/1.1" 200 877
2013-01-11 17:35:49,976 response: {'status': '200 OK', 'content-length': '877', 'x-github-media-type': 'github.beta', 'x-content-type-options': 'nosniff', 'vary': 'Accept, Authorization, Cookie', 'server': 'nginx/1.0.13', 'last-modified': 'Fri, 11 Jan 2013 20:59:17 GMT', 'connection': 'keep-alive', 'etag': '"0aca9098cc4405b0f0fd956d5cf8f733"', 'cache-control': 'private, max-age=60, s-maxage=60', 'date': 'Fri, 11 Jan 2013 22:35:49 GMT', 'x-oauth-scopes': 'gist', 'content-type': 'application/json; charset=utf-8', 'x-accepted-oauth-scopes': 'gist'}
2013-01-11 17:35:51,354 request: get http://git.XXXXXX.local/gist/raw/1/ae6b38c6cf7a929e49b554721665939211a5d7de/server.js {'Authorization': u'token 751d6a0ae34b262a9f0dba9406c6db09b49803b4'} None
2013-01-11T17:35:51.354717   GET   http://git.XXXXXX.local/gist/raw/1/ae6b38c6cf7a929e49b554721665939211a5d7de/server.js
2013-01-11 17:35:51,354 Starting new HTTP connection (2): git.XXXXXX.local
2013-01-11 17:35:51,780 "GET /gist/raw/1/ae6b38c6cf7a929e49b554721665939211a5d7de/server.js HTTP/1.1" 302 101
2013-01-11T17:35:51.781297   GET   http://git.XXXXXX.local/login
bgreenlee commented 11 years ago

That all looks fine--except for the redirect to the login page at the end, of course. It's got to be some kind of configuration issue. Unfortunately, I don't have admin access to our GH Enterprise install, so I can't poke around myself to see. Maybe I'll request a Enterprise trial so I can test it myself.

jasonpincin commented 11 years ago

Very sorry to take up your time, I went through the configuration console again and did find the culprit. "Private Instance": disabled anonymous access to any area of the GitHub installation.

I cleared that flag and now it's working.

bgreenlee commented 11 years ago

No problem. I still don't understand why it wasn't working, since it shouldn't be anonymous access, as we're sending an auth token. shrug Glad it's working.