pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.33k stars 125 forks source link

Authentication Required even though already logged in #276

Closed protex closed 2 years ago

protex commented 2 years ago

Issue Description

Type: Bug Report

Describe what happened (or what feature you want)

I'm attempting to use this with an enterprise account. I've set the hostname correctly in the config and also authenticated via https (I've also tried SSH). However, when I run Oct pr list (or any other command that requires authentication) I get this message:

gh: This endpoint requires you to be authenticated. (HTTP 401)

When I run gh auth status, I get this output showing me I'm logged in:

<enterprise-url>
  ✓ Logged in to <enterprise-url> as <username> (/Users/<username>/.config/gh/hosts.yml)
  ✓ Git operations for <enterprise-url> configured to use https protocol.
  ✓ Token: *******************

Describe what you expected to happen

I expect to be able to list pr's and do other things that require authentication when I am logged in

How to reproduce it (as minimally and precisely as possible)

  1. log in using gh auth login --hostname <enterprise-url>
  2. Open neovim within git repo
  3. run Octo pr list

Tell us your environment

OSX 11.6.4 (intel)

Anything else we need to know?

pwntester commented 2 years ago

Can you try re-authenticating using GITHUB_TOKEN= gh auth login

protex commented 2 years ago

No luck, still get the same error. I also realized I can run :!gh pr list and that also works. It's just when I run through the octo command that it doesn't work.

bzub commented 2 years ago

I have this issue also. It seems as though the problem only happens if there are multiple hosts in my ~/.config/gh/hosts.yaml. A workaround is to comment out my github.com host if I'm using Octo with my enterprise git repo.