gkeepapi icon indicating copy to clipboard operation
gkeepapi copied to clipboard

gkeepapi.exception.LoginException: ('UNKNOWN_ERR', None)

Open csimpf opened this issue 10 months ago • 11 comments

Hi there, I love your app and it's been so solid in helping me sync my Keep shopping list with Anylist 😄

Since 31 Jan this year, I've been persistently getting this error and can't log in. Stack Trace:

Traceback (most recent call last):
  File "lambda_function.py", line 76, in <module>
    lambda_handler(mock_event, mock_context)
  File "lambda_function.py", line 18, in lambda_handler
    success = keep.login(os.environ["GOOGLE_USERNAME"], os.environ["GOOGLE_APP_PASSWORD"])
  File "/home/name/code/keep2anylist/keep-get/lib/python3.8/site-packages/gkeepapi/__init__.py", line 697, in login
    ret = auth.login(email, password, device_id)
  File "/home/name/code/keep2anylist/keep-get/lib/python3.8/site-packages/gkeepapi/__init__.py", line 62, in login
    raise exception.LoginException(res.get("Error"), res.get("ErrorDetail"))
gkeepapi.exception.LoginException: ('UNKNOWN_ERR', None)

I've tried generating a new app key but that didn't fix things.

I have also tested with a bad password and I get gkeepapi.exception.LoginException: ('BadAuthentication', None), so the password seems correct.

Do you have any pointers or idea on what could be going on? Please let me know if I can provide more information. Thanks in advance!

csimpf avatar Feb 04 '26 11:02 csimpf

Oop... I'm using a very old version of this package (0.14.2). Will check that upgrading fixes this and close if so.

csimpf avatar Feb 04 '26 11:02 csimpf

Python version: 3.12.12 gkeepapi version: 0.17.1

csimpf avatar Feb 04 '26 12:02 csimpf

I'm having the same problem. It was working fine for me last week, then I received alert that google logged me out of something for "suspicious activity". Now I always receive the same above error

kgaquin avatar Feb 13 '26 12:02 kgaquin

how did you folks get your master token? how often were you using it? do you use 2fa on your account? was it an application password?

smemsh avatar Feb 18 '26 00:02 smemsh

I used the alternative method from here https://github.com/simon-weber/gpsoauth#alternative-flow

Account I'm using for this does not have 2FA setup. I finished setting up my script the previous week, so would have used it quite a bit at that time. But when I got the suspicious activity email that said I was logged out, it had been a few days since I used the token.

kgaquin avatar Feb 18 '26 02:02 kgaquin

I used the EmbeddedSetup and token from cookie jar also. it appears that it's the only way that works anymore. I do have 2FA and am not using app password (which I tried first, but that didn't work). I set up mine about a week ago also, but mine is still working.

what was the your frequency of using the master token once you stabilized? I'm doing every 8 hours for backup purposes. now I'm worried I should back it off.

Did you ever try a new EmbeddedSetup?

smemsh avatar Feb 18 '26 09:02 smemsh

Hey all! Thanks for your responses and comments.

I was using the old keep.login method using an app password so have attempted to try using keep.authenticate using master token instead.

I went through the EmbeddedSetup to get my master token, but using this method now results in a BadAuthentication error for me☹️ The token is in the format g.abcdef..., unsure if this is correct.

@kgaquin is this the same state your account is in now?

csimpf avatar Mar 08 '26 12:03 csimpf

I just created a whole new Google account, and authenticating via my phone hotspot (in case my IP was marked as suspicious). Still getting the BadAuthentication error.

This does seem to happen regardless of the username/password; so I'm wondering/hoping I have something formatted incorrectly.

csimpf avatar Mar 08 '26 12:03 csimpf

The token is in the format g.abcdef..., unsure if this is correct.

it should start with aas_et/

smemsh avatar Mar 08 '26 13:03 smemsh

Ah, that did it! Thank you @smemsh. My setup is now working again after switching to authenticate using my master token 👍

cc @kgaquin let me know if you want a hand setting up again. The aas_et/... master token is a little more hidden in the docs.

csimpf avatar Mar 09 '26 11:03 csimpf

doesn't seem very hidden:

Types of tokens

  • Authentication token (starts with oauth2_4/) expires quickly, can be used only once
  • Master token (starts with aas_et/) never expires
  • Access token (starts with ya29.) expires in 1 hour

smemsh avatar Mar 09 '26 13:03 smemsh