djsudduth / keep-it-markdown

Convert Google Keep notes dynamically to markdown for Obsidian, Logseq, Joplin and Notion using the unofficial Keep API. Also, import simple markdown notes back into Google Keep.
Apache License 2.0
493 stars 32 forks source link

LoginException('BadAuthentication', None) #56

Closed darylf closed 1 year ago

darylf commented 1 year ago

I generated an app password, but I can't seem to get it to pass the keep-test.py authentication.

Things I've tried which I found in previous Issues:

  1. following the link in the error message, but I get a 404
  2. pip3 install --upgrade keyrings.alt didn't solve anything

Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: keyrings.alt in /home/username/.local/lib/python3.11/site-packages (4.2.0) Requirement already satisfied: jaraco.classes in /home/username/.local/lib/python3.11/site-packages (from keyrings.alt) (3.2.3) Requirement already satisfied: more-itertools in /home/username/.local/lib/python3.11/site-packages (from jaraco.classes->keyrings.alt) (9.0.0)

I'm not sure what else I can try to troubleshoot, or what else I can offer to help others understand my issue. Any advice would be welcomed.

djsudduth commented 1 year ago

What OS and version are you using? Also, are you using KIM 0.5.0? keep-test.py was deprecated to only providing the token if you needed to copy it.

djsudduth commented 1 year ago

PS - I just ran it on Debian 11 using 2FA without any issue. Be sure you don't add spaces to the 2FA app password. Also, you may want to try sudoing the script.

darylf commented 1 year ago

I'm using Fedora 37 with Python 3.11.1

At first I was using a clone of this repo, but I just downloaded the 0.5.0 release zip file and it still isn't working. I see a deprecation warning for imghdr, I'm not sure if that's relevant:

/home/username/Downloads/keep-it-markdown-0.5.0/kim.py:6: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 import imghdr

Stupid question: is a google account username typically an email address? (I'm using my gmail)

I tried running sudo python kim.py, but that didn't work as I was missing the required dependencies. I then ran sudo sh, installed the requirements.txt, and tried python kim.py from the sudo shell, still got the same error.

djsudduth commented 1 year ago

Hmmm.....I've seen this happen on Windows but not on Linux before. Do you have any network blocks / antivirus blocks running? Or, do you have multiple browsers on Fedora? PS - I haven't tested on v3.11.x of Python yet - but, assuming that isn't the issue.

djsudduth commented 1 year ago

Take a look at this comment in the unofficial API -> https://github.com/kiwiz/gkeepapi/issues/81#issuecomment-770389348 (note his instructions say to use pip instead of pip3 - I think that's a typo) - maybe try the venv approach??

I do think there's something device specific that causes this problem - but, I have yet to discover it.

djsudduth commented 1 year ago

Tested it on Python v3.11.2 - worked ok

djsudduth commented 1 year ago

@darylf - I think using venv might be a good thing to try - or, installing a separate fresh version of python and setting your environment to point to it so it's a clean install.

jshph commented 1 year ago

I encountered this on my computer too. Set some breakpoints and found that the browser login was required.

See: https://github.com/kiwiz/gkeepapi/issues/95 https://github.com/kiwiz/gkeepapi/issues/81

I resolved it according to the second link by generating a temp password as instructed! In my case, I am signed into two Google accounts, probably part of the reason why.

djsudduth commented 1 year ago

Glad you solved it @jshph!! The 2FA app password seems to work for most. (Note that you don't need to use those links to the gkeepapi - the 2FA temp pw instructions are on this repo's README - for anyone else having this problem - I believe the 0.5.0 download version didn't get the updated README on the github repo page. This will get added in 0.5.1)

rkallensee commented 1 year ago

I had this issue, too - Ubuntu 22.10, Python 3.10.7, Google account with 2FA, used app password without success. Then I tried it within an ubuntu:20.04 Docker image and a folder shared with the host filesystem where I checked out this repository, ran apt-get install python3.8 python3-pip, installed the requirements via pip and ran python3 kim.py -r. It worked! I could imagine it has something to do with Python 3.8 working but 3.10 not.

djsudduth commented 1 year ago

@rkallensee very odd! All of my development was on 3.10.x and I tested on 3.11.x. I'm not sure why these login blockers appear sometimes. Maybe something about the packages in an existing environment vs a fresh one? Just not sure...

djsudduth commented 1 year ago

See #71 for possible fix to the LoginException('BadAuthentication', None) error