Function: ghub--token

ghub--token is a byte-compiled function defined in ghub.el.

Signature

(ghub--token HOST USERNAME PACKAGE &optional NOCREATE FORGE)

Source Code

;; Defined in ~/.emacs.d/elpa/ghub-20260401.1239/ghub.el
(defun ghub--token (host username package &optional nocreate forge)
  (let* ((user (ghub--ident username package))
         (token (or (ghub--auth-source-get :secret :host host :user user)
                    (and (string-match "\\`\\([^/]+\\)" host)
                         (ghub--auth-source-get :secret
                           :host (match-string 1 host)
                           :user user)))))
    (unless (or token nocreate)
      (error "\
Required %s token (%S for %s%S) does not exist.
See https://docs.magit.vc/ghub/Getting-Started.html
or (info \"(ghub)Getting Started\") for instructions."
             (capitalize (symbol-name (or forge 'github)))
             user
             (if (string-match "\\`\\([^/]+\\)" host)
                 (format "either %S or " (match-string 1 host))
               "")
             host))
    (if (functionp token) (funcall token) token)))