nyyManni / ejira

Emacs JIRA integration
GNU General Public License v3.0
256 stars 35 forks source link

How to use with Jira cloud #48

Closed dorneanu closed 2 years ago

dorneanu commented 2 years ago

Hi!

I've searched through some of the open and closed issues here but I couldn't find an answer to my problem.

Here is my config:

(use-package jiralib2
  :config
   (setq jiralib2-url              "https://<company>.atlassian.net"
        jiralib2-auth             'token
        jiralib2-user-login-name  "victor.dorneanu@<company TLD>")
)

(use-package ejira
  :init
  (setq
         ;; NOTE, this directory needs to be in `org-agenda-files'`
        ejira-org-directory       org-directory
        ejira-projects            '("TEST")

        ejira-priorities-alist    '(("Highest" . ?A)
                                    ("High"    . ?B)
                                    ("Medium"  . ?C)
                                    ("Low"     . ?D)
                                    ("Lowest"  . ?E))
        ejira-todo-states-alist   '(("To Do"       . 1)
                                    ("In Progress" . 2)
                                    ("Done"        . 3)))
  :config
  ;; Tries to auto-set custom fields by looking into /editmeta
  ;; of an issue and an epic.
  ;; (add-hook 'jiralib2-post-login-hook #'ejira-guess-epic-sprint-fields)

  ;; They can also be set manually if autoconfigure is not used.
  ;; (setq ejira-sprint-field       'customfield_10001
  ;;       ejira-epic-field         'customfield_10002
  ;;       ejira-epic-summary-field 'customfield_10004)

  ;; (require 'ejira-agenda)

  ;; Make the issues visisble in your agenda by adding `ejira-org-directory'
  ;; into your `org-agenda-files'.
  (add-to-list 'org-agenda-files ejira-org-directory)

  ;; Add an agenda view to browse the issues that
  (org-add-agenda-custom-command
   '("j" "My JIRA issues"
     ((ejira-jql "resolution = unresolved and assignee = currentUser()"
                 ((org-agenda-overriding-header "Assigned to me")))))))

Then I set jiralib2-token via SPC h v (I use Doom Emacs). I can copy the token from the browser (using developer mode in Google Chrome).

And then I run jiralib2-verify-setup . Afterwards I see:

Loading /home/victor/.emacs.d/.local/cache/recentf...done
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://<company>.net/rest/api/2/myself parse-error
Session expired, retrying...
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://<company>.atlassian.net/rest/api/2/myself parse-error
jiralib2--verify-status: Request failed: invalid password

But again: I'm not using username + password. I use a token to authenticate myself.

ELISP> (print jiralib2-auth)
token
ELISP> (print jiralib2-url)
"https://<company>.atlassian.net"
ELISP> 

Thanks in advance.

nyyManni commented 2 years ago

The projects that I am currently working on will migrate into JIRA Cloud within the next few months, so I will anyway look into this in more detail in the near future.

eddiegroves commented 2 years ago

Just started playing with this project (awesome so far @nyyManni, thank you!) and it seems to work out of the box with Jira Cloud.

Create an API token here: https://id.atlassian.com/manage-profile/security/api-tokens

dorneanu commented 2 years ago

Create an API token here: https://id.atlassian.com/manage-profile/security/api-tokens

That was the missing part. Thanks for clarification!

eddiegroves commented 2 years ago

Glad to hear @dorneanu! Don't forget to close the issue if it's now resolved 😀