vermiculus / magithub

**DEPRECATED - please use Forge instead!** -- Magit-based interfaces to GitHub
GNU General Public License v3.0
579 stars 63 forks source link

Magithub makes requests as 'ghub' #276

Closed cpitclaudel closed 6 years ago

cpitclaudel commented 6 years ago

When I press RET on a notification to visit the page, I get a message from ghub asking from a token:

Such a Github API token is not available:

  Host:    api.github.com
  User:    cpitclaudel
  Package: ghub

  Scopes requested in `ghub-github-token-scopes':
    repo
  Store locally according to `auth-sources':
    ("~/.authinfo" "~/.authinfo.gpg" "~/.netrc")
  Store on Github as:
    "Emacs package ghub @ clem-w50-mint"

WARNING: If you have enabled two-factor authentication then
         you have to abort and create the token manually.

If in doubt, then abort and first view the section of the Ghub
documentation called "Manually Creating and Storing a Token".

Otherwise confirm and then provide your Github username and
password at the next two prompts.  Depending on the backend
you might have to provide a passphrase and confirm that you
really want to save the token.

Create and store such a token? 

This seems to come from this code:

(defun magithub-notification-browse (notification)
  "Visits the URL pointed to by NOTIFICATION."
  (interactive (list (thing-at-point 'github-notification)))
  (if notification
      (let-alist notification
        (cond
         ((member .subject.type '("Issue" "PullRequest"))
          (ghubp-patch-notifications-threads-id notification) ;; ← HERE
          (magithub-issue-view (magithub-request (ghubp-follow-get .subject.url))))
         (t (if-let ((url (or .subject.latest_comment_url .subject.url))
                     (html-url (alist-get 'html_url (magithub-request (ghubp-follow-get url)))))
                (browse-url html-url)
              (user-error "No target URL found")))))
    (user-error "No notification here")))

The Package: ghub seems wrong. Shouldn't the code pass magithub as :auth somehow?

Thanks!

vermiculus commented 6 years ago

Bah, yes; that's what magithub-request does 😄 I should really write a linter to make sure these requests are always wrapped.

vermiculus commented 6 years ago

(Thanks for the report!)