Skip to content
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

Google Authentication issues #57

Open
flecmart opened this issue Dec 15, 2023 · 12 comments
Open

Google Authentication issues #57

flecmart opened this issue Dec 15, 2023 · 12 comments

Comments

@flecmart
Copy link
Owner

What currently works is:

urllib3<2
gpsoauth==1.0.2
gkeepapi==0.14.2

on python:3.11-bullseye image with OpenSSL 1.1.1w 11 Sep 2023

As soon as I upgrade gpsoauth or gkeepapi (which uses gpsoauth), I end up with something like this: {"Error": "NeedsBrowser", "Url": "https://accounts.google.com/signin/continue?sarp=1&scc=1&continue=https://accounts.google.com/o/android/auth?hl%3Den_us%26xoauth_display_name%3DAndroid%2BLogin%2BService%26source%3DAndroid%2BLogin&plt=VERY_LONG_TOKEN_REDACTED", "ErrorDetail": "To access your account, you must sign in on the web. Touch Next to start browser sign-in."} - also see simon-weber/gpsoauth#60

As soon as I upgrade the os to OpenSSl 3, I end up with BadAuthentication - also see simon-weber/gpsoauth#48

@flecmart flecmart pinned this issue Dec 15, 2023
@flecmart
Copy link
Owner Author

If someone has a running version with gkeepapi==0.15.1 please let me know :-)

@mchoochoo
Copy link

Screenshot 2024-02-17 at 10 32 35 AM

Hi, I'm new to GitHub and scripts. I opened an account at Python Anywhere to be able to run this script. Then I cloned this GitHub, and then followed your instructions. But when I get to the last step, I get this error. Are you able to assist?

@flecmart
Copy link
Owner Author

Hi,

I recommend trying to use the docker image. Propably u got some conflict with openssl on python anywhere.

@mchoochoo
Copy link

mchoochoo commented Feb 18, 2024 via email

@flecmart
Copy link
Owner Author

flecmart commented Feb 18, 2024 via email

@mchoochoo
Copy link

mchoochoo commented Feb 18, 2024 via email

@flecmart
Copy link
Owner Author

flecmart commented Feb 18, 2024 via email

@Neislerw
Copy link

Getting a failure at the "requesting new token", I have gone through and updated everything on my pi and reinstalled the docker. I run it through portainer. I am not super savy, so any advice for troubleshooting would be appreciated!

`2024-03-11 18:48:25 configManager-INFO: validating configuration with schema 'config.schema.yaml'
2024-03-11 18:48:25 configManager-INFO: schema validation passed 👍
2024-03-11 18:48:25 configManager-INFO: configuration validation passed 👍
2024-03-11 18:48:25 configManager-INFO: updated config: config.yaml
2024-03-11 18:48:25 app-INFO: authenticating gkeepapi
2024-03-11 18:48:25 app-INFO: requesting new token
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/venv/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f84b32710>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='android.clients.google.com', port=443): Max retries exceeded with url: /auth (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f84b32710>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/app.py", line 234, in <module>
    google_login(keep, configManager.config['google_username'], configManager.config['google_password'], device_id='3ee9002270d00157')
  File "/app/app.py", line 48, in google_login
    keep.login(user, password, sync=False, device_id=device_id)
  File "/venv/lib/python3.11/site-packages/gkeepapi/__init__.py", line 697, in login
    ret = auth.login(email, password, device_id)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/gkeepapi/__init__.py", line 54, in login
    res = gpsoauth.perform_master_login(self._email, password, self._device_id)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/gpsoauth/__init__.py", line 143, in perform_master_login
    return _perform_auth_request(data, proxy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/gpsoauth/__init__.py", line 86, in _perform_auth_request
    res = session.post(AUTH_URL, data=data, verify=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='android.clients.google.com', port=443): Max retries exceeded with url: /auth (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f84b32710>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))`

@flecmart
Copy link
Owner Author

flecmart commented Mar 11, 2024 via email

@Neislerw
Copy link

Whoops, yeah it seems like my pi-Hole docker was the issue. It was working fine for months, not sure what changed, but switching back to default DNS fixed the issue. I'll have to look in to it closer to see if I can have them both working at the same time.

Thanks for the pointer! Great project by the way!

@flecmart
Copy link
Owner Author

Meanwhile there were updates to gpsoauth and gkeepapi as a lot of users had those problems. See #77 and #66

Some info on the alternative approach here: https://github.com/simon-weber/gpsoauth?tab=readme-ov-file#alternative-flow Last time when I read through I thought it was not as intuitive and easy as the current working flow, but I think at some point I need to upgrade those dependencies and test it myself. But at the moment I have no time... if anyone has the resources and skills to implement and test those changes I am happy to review and merge it - more I cannot do at the moment because I don'
t have any spare free time.

@flecmart
Copy link
Owner Author

flecmart commented Jan 5, 2025

Update: I implemented the new authentication flow in #91.

Did not have time to really test it yet and do not want to break thins that are working still, but in case someone wants to try just clone the code from the branch in the referenced pull request. It should work I did start up the sync and everything seemed to work. If you want to try, just

  1. Go through the updated README.md and get your oauthMasterToken
  2. Update config

And everything should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants