Skip to content

Getting jira token from auth source breaks with some auth source backends #74

Description

@vseguip

Some custom emacs source backends return the secret as string and not functions which breaks the current jira-api--token function. The fix is to use auth built-in function auth-info-password which can retrieve the secret from either kind. E.g

(defun jira-api--token ()
    "Retrieve the token for current JIRA URL from config or auth-source."
    (if (and jira-token (not (string= "" jira-token)))
	jira-token
      (let* ((current-url (jira-api--get-current-url))
             (auth-host (replace-regexp-in-string "https://" "" current-url))
	     (auth-info (car (auth-source-search :host auth-host :require '(:secret)))))
	(when auth-info (auth-info-password auth-info)))))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions