-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New login issue (Was working fine for months) #123
Comments
Possibly - here's some things you can try:
While it won't help with the current situation, I also recommend caching the login authentication data like so: https://github.com/kiwiz/gkeepapi/blob/master/examples/resume.py. This means less authentications, which means Google is less likely to mark the requests as suspicious. |
I encountered the same issue, while it was working fine for more than one year. What i tried and doesn't work :
Is it working for someone or the gkeepAPI is currently no longer compatible with Google Keep ? |
Just tried reauthenticating (I've been using cached auth data) and also get a "NeedsBrowser" response. :/ I did some digging into the browser flow as mentioned here: simon-weber/gpsoauth#13. This results in a |
Hi @kiwiz ,
Could you give a bit more details as to what needs to be fixed? The issue you linked to is open since 2016 so I'm not sure how it's related to this one. |
Putting a breakpoint in Pasting this URL in your browser walks you through a two-factor authentication. At the end of this, though, you end up with a page that has a spinner and a "One moment please..." message which never goes away. Repeating the `authentication, leads to the same result. |
gkeepapi relies on being able to get a "master token", which is used to generate an OAuth token with the necessary Google Keep scopes. When you get a |
I've reached the same conclusion. If you snoop a real device's traffic and grab the AAS token, it can be hardcoded here and playstore token generation will then work. Some RE work on what has changed regarding AAS token generation is needed -- i'm looking into this and will share my findings. Is Aurora broken too? They usually have up-to-date implementations of the auth mechanisms |
Good call on checking out Aurora. It looks like the new flow might already be implemented here: https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/app/src/main/java/com/aurora/store/view/ui/account/GoogleActivity.kt#L80-92 |
... and the implementation is here: https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/app/src/main/java/com/aurora/store/util/AC2DMTask.kt#L27-43. From a quick look, it looks like we just need to set If anyone wants to take a stab at this, feel free. Otherwise, I'll take a look at it when I have time. |
nice find. the ac2dm flow is new to me and i'll need some time to incorporate and test it. I can't open a PR on this project for work-related reasons but I can privately share snippets of the implementation with you (assuming I get something working). |
Hey guys, I've ran into this issue on another project that uses gpsoauth. Here's an example request that I made by intercepting my own device's auth flow, it can probably be stripped down further and implemented better into gpsoauth. https://android.googleapis.com/auth?androidId=&lang=en-US&google_play_services_version=221514037&sdk_version=30&build_product=redfin&build_brand=google&Token=&build_device=redfin&service=ac2dm&get_accountid=1&ACCESS_TOKEN=1&callerPkg=com.google.android.gms&add_account=1&callerSig=38918a453d07199354f8b19af05ec6562ced5788 |
Happy I am not alone here and that my sharing yielded some shared expertise here. Failures with official GoogleKeep APIHoping this results in a fix as I was never able to get the official GoogleKeep API that was announced/released working and my conclusion was that the necessary scopes for the official are actually only available if I have an enterprise Google account, which I don't have. Praise for Documentation for this projectMeanwhile, I am pretty invested in the amazing work @kiwiz here and all. The ReadTheDocs documentation here is excellent! Some great code on Github but great documentation for this code is rare. oAuth griefIn general I get the oAuth might be more secure but it's also annoying. |
I try fix gpsoauth code in my site-pacakge, but not work, is have to chagne gkeepapi code ?
|
gpsoauth released a new version this morning (1.0.1) addressing this. Is there anything other than updating the dependency that needs to happen here? |
New Release and Commit that fixes the issue I'll try to update the dependency manually and see if it fixes the issue Update: I currently have a functioning python3 env, my |
I use ha-google-home which has a dependency on gpsoauth, their update forced the upgrade on my instance. gkeepapi is working for me now with gpsoauth 1.0.1 in my environment. Not a super clean test, but it looks good from here! |
I updated gpsoauth and scripts are working now. |
Thanks for testing. I've bumped the dependency on |
Can confirm: works now perfectly! |
Damn. No luck for me. All worked fine in April. Saw this in Google Account Help page: |
Try using an app password which can be created here instead of a password. I just checked and |
I did that. I did all as topic starter did. Again all worked just fine in April with python 3.10. I upgraded gpsoauth and gkeepapi today but no luck. I honestly don't know what to do else. |
There is my simple code if it helps. def keep_update(): gkeepapi.exception.LoginException: ('NeedsBrowser', 'To access your account, you must sign in on the web. Touch Next to start browser sign-in.') |
Does the error occur at |
I use the same code import gkeepapi
keep = gkeepapi.Keep()
login = keep.login(...,...) which works Can you assure that you are using the correct versions (i.e. in the python interactive mode)? Sometimes python does some funky stuff with its modules versions... |
yes, it does.
versions are correct I gave up and switched to simplenote |
Same here, I fail to login
I tried with either my google password, [1] https://support.google.com/mail/answer/185833 any clue? |
It is a mystery to me why it doesn't work on your machine...
The only small difference I see is the python version ( |
Hi, thank you so much for taking the time! I can try downgrading python, if that's possible, would this make sense? Maybe another difference : I'm running a Raspberry pi 400 (with Ubuntu 22.04), could this have any effect? Also, I have a very poor internet connection, would a long answer delay be taken as failure? How could I trace what's happening precisely? |
I am not sure if anyone else is coming across this issue but once I attempt to login I get this Exception error:
I click on the link, and after prompted to login, it is at an endless loop on the page saying "One moment please" that looks like this even after an hour: UPDATE: |
An app password needs to be generated. This is the solution. |
Hey y'all, I know this is a separate project, but I'm really lost at this point. I'm working with keep-it-markdown which uses this repo and I keep getting LoginException(BadAuthentication, None) when I try to login. I've gone through the process of triple-checking:
Running on macOS 12.6.1 and using python 3.9.6, so I really don't get what gives here. Any help is greatly appreciated. |
Generating a google app password solved the issue |
I have this BadAuthentication problem also (OS X 13.5.1, Python 3.11.5, gkeepapi 0.14.2, gpsoauth 1.0.2, requests 2.31.0, Google 2FA with app password). I had no luck downgrading Python, requests, etc. as others describe. In the end I'm successfully able to use https://hub.docker.com/r/rcdeoliveira/gkeepapi (which simply uses latest Python3 on Ubuntu with requests 2.23.0) to run my code that uses gkeepapi. |
pin versions of gpsoauth & gkeepapi because I encountered weird issues with the newest versions using an app password. reference: kiwiz/gkeepapi#123
I am reading this now thinking that the issue is resolved. I am sing your work, because I wanted to integrate Google Keep Todo list to MagicMirror. I installed everything today, but getting the same issue as @kyrlon mentioned above. |
According to my investigation, this login issue caused by gpsoauth. The sample code below caused NeedsBrowser gpsoauth error. from gpsoauth import perform_master_login, perform_oauth
def getToken(email, password, android_id):
response = perform_master_login(email, password, android_id)
if "Token1" not in response:
print("Master login failed.")
if response.get("Error") == "NeedsBrowser":
print(response.get("Url"))
print(response["Token1"])
getToken('********@gmail.com', 'password', '3ee9002270d00157') Speculation: google's specification change? |
@airosB find is strange that Google makes accessing Keeps so difficult compared to some of their other products. I was wondering if I should look for a workaround, like somehow backing up the Todo items in Keep to a Google Sheet and see if I can access that any easier. After all I only need to see the items in MagicMirror, no need to update them externally. |
The issue
I've been using this code successfully for the past few months (thank you!) and then it suddenly stopped working. I am getting the error posted below. I am wondering if this is the result of security changes at Google? Or what I am overlooking in my attempt to debug.
My attempts at solving
I tried turning off two-factor and reseting and then creating a new app pass but that produced same error. Again, any help is appreciated as I depend on this for my workflow.
Error
File "/Users/Me/Projects/gkeep/test.py", line 4, in <module> success = keep.login('[email protected]', 'apppassword') File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 695, in login ret = auth.login(username, password, device_id) File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 59, in login raise exception.LoginException( gkeepapi.exception.LoginException: ('NeedsBrowser', 'To access your account, you must sign in on the web. Touch Next to start browser sign-in.')
Running this code
`import gkeepapi
keep = gkeepapi.Keep()
success = keep.login('[email protected]', 'workingapppasswork')
note = keep.createNote('Todo', 'Eat breakfast')
note.pinned = True
note.color = gkeepapi.node.ColorValue.Red
keep.sync()`
The text was updated successfully, but these errors were encountered: