nyyManni / ejira

Emacs JIRA integration
GNU General Public License v3.0
255 stars 36 forks source link

Login fails #7

Open m1cl opened 5 years ago

m1cl commented 5 years ago

I cannot login. It says my password is wrong. I tried it with my email, Full Name, Nick Name etc. Nothing worked. Is it possible to use a API token instead?

suzil commented 4 years ago

I was trying for awhile today to make it work, but had problems with connecting. It looks like Jira is deprecating cookie-based authentication.

The deprecation period for this functionality has ended. From June 3rd, 2019, we will be progressively disabling the usage of this authentication method. If you are using a REST endpoint in Jira with basic authentication, update your app or integration to use API tokens, OAuth, or Atlassian Connect.

https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/

Is the performance of basic auth with a token poor enough that this project would not work? Would oauth work better?

nyyManni commented 4 years ago

I would love to implement OAuth or token auth, but unfortunately our company is using JIRA Server instead of JIRA Cloud and it does not seem to support either of those (or I do not have enough access rights to enable them). Thus I do not have anything to test these login methods with, which makes them difficult to implement.

Atlassian completely deprecating cookie-based auth is unfortunate for Ejira.

They seems to offer a free evaluation for JIRA Cloud, but it is only 7 days, so it would make for a quite agile feaure release :sweat_smile:

JIRA Server has a 30 day evaluation period. I could run it locally and check if I can get OAuth tokens working there, as I would be the admin. But that hard deadline might still be too much for my calendar.

suzil commented 4 years ago

Aha yeah it looks like API tokens are a no-go for Jira Server.

Jira Server does not provide those specific types of API tokens that can be used in basic auth, like Jira Cloud does. If you want to create a token in Jira Server for use in REST calls, you need to create an OAuth token, which has an expectation of creating an application link as described in Jira Server Devleoper page on OAuth.

Maybe Ejira could be migrated to support both token-based and OAuth-based authentication? I have setup API tokens and it seems to work fine (maybe a bit slow to load issues but I'm already used to that when working with Jira).

I could make a PR to replace the current not-working (or does it work for you?), soon-to-be-deprecated cookie-based approach with the token approach. And then in a later PR I could try to setup OAuth?

nyyManni commented 4 years ago

The cookie-auth does work for me currently, I am using it on a daily basis.

If you could create a pull request with a working OAuth, it would be greatly appreciated. Even if you did one which replaces the cookie authentication with OAuth I could then stitch that code into ejira to work with both.

One thing that I would propose, though, is to make the pull request to https://github.com/nyyManni/jiralib2, as it was recently extracted away from Ejira. I will remove jiralib2.el from this repository in the "near future".

nyyManni commented 4 years ago

Repository at https://github.com/nyyManni/jiralib2 now updated with support for cookie, basic and token auth. Tested with a self-hosted JIRA Server and a JIRA Cloud trial. Would be nice if you could give it a try before my JIRA Cloud trial expires after 7 days :smile:.

OAuth approach is a bit more involved, I might get into that #later.

yqrashawn commented 4 years ago

Just tested it. Login successfully to jira cloud with api token. But get error when calling ejira-guess-epic-sprint-fields. We don't have any sprint on jira.

Attempting to auto-configure Ejira custom fields...
REQUEST [error] Error (error) while connecting to https://company.atlassian.net/rest/api/2/issue/nil/editmeta.
user-error: Request failed: Wrong URL path
nyyManni commented 4 years ago

@yqrashawn

It seems that either of the queries in ejira-guess-epic-sprint-fields does not return any results. The queries are:

It is more likely that it is the first one which is failing. What is your setting of ejira-epic-type-name and does it correspond to the type name of an Epic on your JIRA?