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

Automatically initiate reauth if token expires #6

Open
etoews opened this issue Jan 3, 2022 · 0 comments
Open

Automatically initiate reauth if token expires #6

etoews opened this issue Jan 3, 2022 · 0 comments

Comments

@etoews
Copy link
Owner

etoews commented Jan 3, 2022

If you have an expired token, you get the exception

(google-photos-sync-check) bash-3.2$ python google-photos-sync-check.py --verbose rebuild_db
Traceback (most recent call last):
  File "google-photos-sync-check.py", line 224, in <module>
    args.func(args)
  File "google-photos-sync-check.py", line 153, in rebuild_db
    for album_page in album_pages:
  File "google-photos-sync-check.py", line 33, in get_album_pages
    albums_response = photoslibrary.albums().list().execute()
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/googleapiclient/http.py", line 883, in execute
    resp, content = _retry_request(
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/googleapiclient/http.py", line 172, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/oauth2client/transport.py", line 186, in new_request
    credentials._refresh(orig_request_method)
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/oauth2client/client.py", line 761, in _refresh
    self._do_refresh_request(http)
  File "/Users/etoews/.local/share/virtualenvs/google-photos-sync-check-9wSNJ860/lib/python3.8/site-packages/oauth2client/client.py", line 819, in _do_refresh_request
    raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request

The client_token.json should be automatically deleted and the auth process retried.

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

1 participant