NiNiyas / autoscan

Fork of https://github.com/l3uddz/plex_autoscan with Jellyfin and Emby support.
GNU General Public License v3.0
54 stars 0 forks source link

TeamDrive monitoring not working due to OOB auth #4

Closed 8a8al00ey closed 1 year ago

8a8al00ey commented 1 year ago

See: https://developers.google.com/identity/protocols/oauth2/resources/oob-migration

redirect_uri: urn:ietf:wg:oauth:2.0:oob is being used and needs to be migrated over to new auth method.

    "CLIENT_ID": "XXXXXXX-XXXXXXXX.apps.googleusercontent.com",
    "CLIENT_SECRET": "XXXXXXXX",
....
    "TEAMDRIVE": true,
    "TEAMDRIVES": [
      "TV,
      "Movies",
      "Movies4K"
    ]
  },
....
 2022-08-29 12:21:42,768 -    DEBUG - requests_oauthlib.oauth2_session [140458550462016]: Requesting url https://www.googleapis.com/drive/v3/changes/startPageToken using method GET.
 2022-08-29 12:21:42,768 -    DEBUG - requests_oauthlib.oauth2_session [140458550462016]: Supplying headers None and data None
 2022-08-29 12:21:42,768 -    DEBUG - requests_oauthlib.oauth2_session [140458550462016]: Passing through key word arguments {'timeout': 30, 'params': {'supportsTeamDrives': False}, 'allow_redirects': True}.
 2022-08-29 12:21:42,936 -  WARNING -    GOOGLE [140458550462016]: Unauthorized Response (Attempts 1/2)
 2022-08-29 12:21:42,936 -    DEBUG - requests_oauthlib.oauth2_session [140458550462016]: Invoking 0 protected resource request hooks.
 2022-08-29 12:21:42,936 -    DEBUG - requests_oauthlib.oauth2_session [140458550462016]: Adding token {'expires_at': 1661790092.9367232} to request.
 2022-08-29 12:21:42,937 -    ERROR -    GOOGLE [140458550462016]: Exception sending request to https://www.googleapis.com/drive/v3/changes/startPageToken with kwargs={'params': {'supportsTeamDrives': False}}:
Traceback (most recent call last):
  File "/opt/p_autoscan/google/drive.py", line 148, in query
    resp = self._do_query(request_url, method, **kwargs)
  File "/opt/p_autoscan/google/drive.py", line 435, in _do_query
    resp = self.http.get(request_url, timeout=use_timeout, **kwargs)
  File "/opt/p_autoscan/venv/lib/python3.8/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/opt/p_autoscan/venv/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 483, in request
    url, headers, data = self._client.add_token(
  File "/opt/p_autoscan/venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 195, in add_token
    raise ValueError("Missing access token.")
ValueError: Missing access token.
 2022-08-29 12:21:42,938 -    ERROR -    GOOGLE [140458550462016]: Error validating access token, status_code = 0, data =

None

 2022-08-29 12:21:42,938 -    ERROR -  AUTOSCAN [140458550462016]: Failed to validate Google Drive Access Token.
Screen Shot 2022-08-29 at 12 41 50 PM
8a8al00ey commented 1 year ago

Not sure when you initially forked this or what branch you used but the develop branch upstream has several fixes to this and other fixes as well.

https://github.com/l3uddz/plex_autoscan/tree/develop

NiNiyas commented 1 year ago

develop branch uses service account to authenticate. Can you try setting the app's publishing status to testing instead of in production?