geeknote icon indicating copy to clipboard operation
geeknote copied to clipboard

2-factor login broke

Open madchap opened this issue 9 years ago • 20 comments

Hi,

It's been a while since I actually logged in with 2FA, but it used to work. I am guessing there was a change on Evernote's side? Here is what I have now with the latest pull.

$ geeknote login
Login: xxxxxxx
Password:
Two-Factor Authentication Code: 658323
>>> : Allow Access...Traceback (most recent call last):
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/geeknote.py", line 1389, in main
 >> : Allow Access...    User().login(**ARGS)
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/geeknote.py", line 40, in wrapper
    return func(*args, **kwargs)
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/geeknote.py", line 582, in login
    if self.getEvernote().auth():
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/geeknote.py", line 201, in auth
    self.authToken = GNA.getToken()
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/oauth.py", line 179, in getToken
    self.allowAccess()
  File "/home/fblaise/.local/lib/python2.7/site-packages/geeknote/oauth.py", line 288, in allowAccess
    token = "&" + urlencode({ 'csrfBusterToken': tree.xpath("//input[@name='csrfBusterToken']/@value")[0]}) + "&" + urlencode({ 'csrfBusterToken': tree.xpath("//input[@name='csrfBusterToken']/@value")[1]})
IndexError: list index out of range

Thanks, Best. fred

madchap avatar Apr 15 '17 14:04 madchap

Evernote has an application password section for when you can't use 2FA with an app. I didn't have any luck getting it to work (maybe it needs to be active for more than 5 minutes). Not the optimal solution but might be an OK workaround until it gets fixed.

evernote

yantis avatar Apr 17 '17 02:04 yantis

I'm having a difficult time reproducing this issue. Could you check which version of geeknote you're using? Would it be possible to start from a zero state, clean install, and show the steps to repeat the problem? Thanks, Jeff

On Sun, Apr 16, 2017, 7:03 PM Jonathan Yantis [email protected] wrote:

Evernote has an application password section for when you can't use 2FA with an app. I didn't have any luck getting it to work (maybe it needs to be active for more than 5 minutes). Not the optimal solution but might be an OK workaround until it gets fixed.

[image: evernote] https://cloud.githubusercontent.com/assets/4214239/25076617/4a4598ae-22d7-11e7-968a-a4f343ec0878.PNG

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jeffkowalski/geeknote/issues/75#issuecomment-294389873, or mute the thread https://github.com/notifications/unsubscribe-auth/AADeMGvbR5DB2Wey6DOXuNl25ckM3Kw1ks5rwshrgaJpZM4M-XCL .

jeffkowalski avatar Apr 17 '17 02:04 jeffkowalski

If it is helpful: I discovered this same issue with a clean install and an old install (same problem on two different machines).

This is the version I am using (which is the master branch on github) https://aur.archlinux.org/packages/geeknote-improved-git/

yantis avatar Apr 17 '17 02:04 yantis

What version? Would you please show the output of the "geeknote" command with no arguments? Are you running version 2.0.11?

On Sun, Apr 16, 2017, 7:38 PM Jonathan Yantis [email protected] wrote:

If it is helpful: I discovered this same issue with a clean install and an old install (same problem on two different machines).

This is the version I am using (which is the master branch on github) https://aur.archlinux.org/packages/geeknote-improved-git/

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/jeffkowalski/geeknote/issues/75#issuecomment-294393277, or mute the thread https://github.com/notifications/unsubscribe-auth/AADeMHuUTJe65hRZL-1xbw1IoSwYyZlRks5rwtC2gaJpZM4M-XCL .

jeffkowalski avatar Apr 17 '17 02:04 jeffkowalski

geeknote
Version: 2.0.10
Geeknote - a command line client for Evernote.

From the default master branch. I also just tried the last release 2.0.9 (Nov 18th, 2016) Same thing.

I also just tested it against the 2.0.11 branch and same thing (attached is a screenshot)

geeknote

yantis avatar Apr 17 '17 03:04 yantis

Thank you Jonathan, this is helpful. Is there something in the debugging logs that clarifies the error? Take a look at the files in ~/.geeknote

On Sun, Apr 16, 2017 at 8:23 PM, Jonathan Yantis [email protected] wrote:

geeknote Version: 2.0.10 Geeknote - a command line client for Evernote.

From the default master branch. I also just tried the last release 2.0.9 (Nov 18th, 2016) Same thing.

I also just tested it against the 2.0.11 branch and same thing (attached is a screenshot)

[image: geeknote] https://cloud.githubusercontent.com/assets/4214239/25077854/7a8f653e-22e2-11e7-9a4c-799f7e59b5b6.PNG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jeffkowalski/geeknote/issues/75#issuecomment-294397777, or mute the thread https://github.com/notifications/unsubscribe-auth/AADeMAbWCgryMB5cG218P2pEAvfRoIHEks5rwttDgaJpZM4M-XCL .

jeffkowalski avatar Apr 17 '17 06:04 jeffkowalski

Jeff, here is the debug log:

2017-04-17 01:41:35,611 geeknote main 1454 : App error: list index out of range
2017-04-17 01:49:24,126 geeknote wrapper 111 : Error: findNotebooks : EDAMUserException(errorCode=9, parameter='authenticationToken')
2017-04-17 01:50:27,166 geeknote main 1454 : App error: list index out of range
2017-04-17 01:58:53,759 oauth login 266 : Incorrect login or password
2017-04-17 01:58:53,760 oauth login 269 : Target URL was not found in the response on login
2017-04-17 02:57:52,538 geeknote main 1454 : App error: list index out of range
2017-04-17 03:19:06,822 geeknote main 1454 : App error: list index out of range

yantis avatar Apr 17 '17 07:04 yantis

Leaving a comment here to mainly say I haven't forgotten about this bug, but Easter week-end made it ectic.

I reported the bug against a fresh install of master branch on a new machine, but had the same issue against an older build (on another machine) which worked just fine (Maybe 2.0.9); to test on the older build that worked, I actually logged out since I was logged in for months -- and could not re-login with the same error reported, which I why I first thought of a change Evernote side.

madchap avatar Apr 19 '17 06:04 madchap

The code that appears to be now failing came from 89c3c3fdde0b32d768f14d283b561e5b8ef53476, which I merged into this fork 5 months ago. @pipakin, I got the code from you. Do you have any idea why it may be failing now?

jeffkowalski avatar Apr 22 '17 08:04 jeffkowalski

This is far from a fix, but to work around, one could substitute a developer token. See oath.py, around line 172, and simply return a string with the dev token. You can get your own dev token at https://www.evernote.com/api/DeveloperToken.action

     def getToken(self):
        # https://www.evernote.com/api/DeveloperToken.action
        return "S=xx:U=xxx:E=xxxxxxxx:C=xxxxxxxxxxx:P=xxx:A=en-devtoken:V=2:H=xxxxxxxxxxxxxxxx"

Please do not commit a change with your dev token. It's private, like a password.

Hope this gets folks going while we search for a real fix.

jeffkowalski avatar Apr 26 '17 04:04 jeffkowalski

Jeff, Thank you. Much appreciated!

yantis avatar Apr 29 '17 08:04 yantis

+1, Thanks.

unlessbamboo avatar Apr 30 '17 02:04 unlessbamboo

same problem here :(

vonProteus avatar May 20 '17 17:05 vonProteus

Was bit by this bug as well. The code in oauth.py looks for the environment variable EVERNOTE_DEV_TOKEN. Setting that worked for me and should be more resilient to code changes than hardcoding it in the source file.

tjstankus avatar Jun 04 '17 18:06 tjstankus

I've encounter the same problem and I found the problem is caused by this failure:

tree.xpath("//input[@name='csrfBusterToken']/@value")

This expression return a empty list.

And the recommendation prompted by @tjstankus and @jeffkowalski works.

cook avatar Jul 02 '17 00:07 cook

It seems that the creation of developer tokens is currently disabled. Is that the only way to fix this still, besides disabling 2FA?

mikemc avatar Sep 22 '17 00:09 mikemc

Not only the creation, and I don't know if that's a coincidence, but my dev token is no longer working... :-/

madchap avatar Sep 23 '17 09:09 madchap

For those longingly hoping for the developer keys to come back...I think they have been disabled on a per user request basis (maybe it was being abused).

You have to create a support ticket, requesting that you require developer keys and that they be re-enabled for your account. I got a reply within 20 minutes with the feature re-enabled for my account (the link now allows me to create keys). Source: https://github.com/bordaigorl/sublime-evernote/issues/194

One can then create an export EVERNOTE_DEV_TOKEN. It will then auto login with geeknote login.

tuna-f1sh avatar Nov 23 '17 15:11 tuna-f1sh

Another option to get around this issue without requiring a developer key seems to be to disable 2FA, login to geeknote, and then allow geeknote as an "Application" in your Evernote settings, which I think should let you use geeknote for up to a year without having to re-log in. Then you can re-enable 2FA and geeknote should still work as long as you don't log out of it (logging back in will require a 2FA code).

mikemc avatar Nov 26 '17 16:11 mikemc

Is there a permanent fix? I tried logging in with application password and it does not work either :-( I do not want to re-generate my 2fa tokens..

arkenoi avatar Dec 15 '17 11:12 arkenoi