nyyManni / ejira

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

Having trouble logging in #30

Closed johnhamelink closed 4 years ago

johnhamelink commented 4 years ago

Hi there,

I'm trying to setup ejira with a JIRA account hosted on atlassian.net

(setq jiralib2-url              "https://<account>.atlassian.net"
        jiralib2-auth             'token
        jiralib2-user-login-name  "<email address>"
        jiralib2-token            "<api token>")

When I run jirlib2-verify-setup, this returns:

Attempting to auto-configure Ejira custom fields...
[error] request--callback: peculiar error: 400
[error] request-default-error-callback: https://<account>.atlassian.net/rest/api/2/search error
user-error: Request failed: invalid request: ((errorMessages Field 'type' does not exist or this field cannot be viewed by anonymous users.) (warningMessages))

Digging deeper, I find that if I hit https://<account>.atlassian.net/rest/auth/1/session from my browser where I'm already logged in, I get the following back:

{
  "self":"https://<account>.atlassian.net/rest/api/latest/user?username=<account number (?)>%3A8<UUID>",
  "name":"<account number (?)>:<UUID>"
}

Using the "name" field from the response as the username:

(setq jiralib2-url              "https://<account>.atlassian.net"
        jiralib2-auth             'token
        jiralib2-user-login-name  "<name field from /auth/1/session response>"
        jiralib2-token            "<api token>")

When I run jirlib2-verify-setup, this returns:

Attempting to auto-configure Ejira custom fields...
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://<account>.atlassian.net/rest/api/2/search parse-error
Session expired, retrying...
Attempting to auto-configure Ejira custom fields...
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://<account>.atlassian.net/rest/api/2/search parse-error
Session expired, retrying...
Attempting to auto-configure Ejira custom fields...
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://<account>.atlassian.net/rest/api/2/search parse-error
Session expired, retrying...
<more of the above>
Attempting to auto-configure Ejira custom fields...
find-auto-coding: Variable binding depth exceeds max-specpdl-size

I'm not sure where to go from here!

johnhamelink commented 4 years ago

Aha, I have found out what the issue was (my lord, is Atlassian's account mangement system overly complex!):

Even though I login with a certain email address, what matters is the email address set here: https://id.atlassian.com/manage-profile/email

Their API does not uniformly return a 401 response if you provide it with the wrong authentication details.