kiwiz / gkeepapi

An unofficial client for the Google Keep API.
MIT License
1.53k stars 114 forks source link

Gpsoauth issue #156

Closed DrMikeyS closed 9 months ago

DrMikeyS commented 9 months ago

On upgrade to the latest version of gkeepapi, which I needed to a bug appearing in an older version, I am unable to get past the "One Moment Please..." screen when trying to browser authenticate.

There is an issue in the gpsoauth repo that discusses this. The solution was to downgrade to 1.0.2, which works fine for me. Gkeepapi also seems fine.

Unfortunately, I can't deploy with docker now as the requirements in gkeepapi require gpsoauth>1.0.3.

Is there any need to have gpsoauth>1.0.3 in the repo? Could it be losened up a little?

kyrlon commented 9 months ago

Looks like there has been a recent PR merged in the gpsoauth. @kiwiz has mentioned once this is in the official release for gpsoauth, he will update gkeepapi. What version of python3 are you running? I had the most trouble with this on python3.11 on a windows10 machine. And eventually got it working somewhat on maybe 3.8 or 3.9. I might try and use the current master branch from source if it takes awhile for gpsoauth to be updated....

kiwiz commented 9 months ago

If you've obtain a valid master token, you should be using that directly instead of re-authenticating with your creds every time. W.r.t. version pinning, does running pip install gpsoauth==1.0.2 in the Docker image build work?

DrMikeyS commented 9 months ago

Looks like there has been a recent PR merged in the gpsoauth. @kiwiz has mentioned once this is in the official release for gpsoauth, he will update gkeepapi. What version of python3 are you running? I had the most trouble with this on python3.11 on a windows10 machine. And eventually got it working somewhat on maybe 3.8 or 3.9. I might try and use the current master branch from source if it takes awhile for gpsoauth to be updated....

Thanks! I am running 3.11.1.

If you've obtain a valid master token, you should be using that directly instead of re-authenticating with your creds every time. W.r.t. version pinning, does running pip install gpsoauth==1.0.2 in the Docker image build work?

I tried that but then the docker refused to complete. Dependency issue. Because gkeepapi was insisting on >1.0.3 it wouldn't accept gpsoauth==1.0.2. If I removed the specified version from gkeepapi i'd get the older version that was giving me an unrelated error.

I'm up and running with a non-pip version of the current gkeepapi that meant I wasn't stuck with the dependency issue, but would be nice to not need to monitor for changes manually.

kiwiz commented 9 months ago

Can you detail how you're installing gkeepapi and gpsoauth? In my experience, pip will throw an error but will allow the installation of incompatible packages. Additionally, the gpsoauth version shouldn't matter if you've already acquired a master token.

DrMikeyS commented 9 months ago

I have them both in a requirements.txt and I have been deploying on fly.io.

I then get the dependency issues detailed here. The error can't be resolved as I cannot loosen either requirement (for gkeepapi or gpsoauth).

The master token works fine in gpsoauth==1.0.2, however on moving to a higher version, it demands the browser re-auth which won't work. It just hangs on "One Moment Please..." screen

kiwiz commented 9 months ago

it demands the browser re-auth which won't work

This part seems strange. Can you post the Dockerfile and the relevant part of your code where (presumably), you're getting a URL back?

DrMikeyS commented 9 months ago

So, it's not stricktly docker. Fly.io use Cloud Native Buildpacks (I think) that detect the code and create a dockerfile as part of the deployment process.

When I upgrade gpsoauth to 1.0.4 this is the error I get: Traceback (most recent call last): File ".../GitHub/shopping-list-keep/backend/main.py", line 53, in <module> keep.login( File ".../GitHub/shopping-list-keep/backend/gkeepapi/__init__.py", line 703, in login auth.login(email, password, device_id) File ".../shopping-list-keep/backend/gkeepapi/__init__.py", line 54, in login raise exception.BrowserLoginRequiredException(res.get("Url")) gkeepapi.exception.BrowserLoginRequiredException: https://accounts.google.com/...

I then follow the link and it gets stuck on the "One Moment Please..." screen.

When I run the same code with gpsoauth==1.0.2 it runs happily. No need to upgrade the token etc.

kiwiz commented 9 months ago

It looks fly.io does support Dockerfiles. Regardless, the stack trace shows that you're authenticating with credentials.

My suggestion is to use the flow documented here:

This flow happens post authentication, so it is much more reliable.

DrMikeyS commented 9 months ago

Thanks! That makes sense and solves things for me.

Shall I leave this open as will still affect those who intend to use credentials?

kiwiz commented 9 months ago

I'm going to close this out and update the docs to put more emphasis on the keep.resume flow.