Skip to content

Commit

Permalink
Fix client_id_file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
anxuae committed May 1, 2022
1 parent 93f7671 commit 6116969
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pibooth_google_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pibooth.utils import LOGGER


__version__ = "1.2.2"
__version__ = "1.2.3"

SECTION = 'GOOGLE'
CACHE_FILE = '.google_token.json'
Expand Down Expand Up @@ -132,6 +132,11 @@ def _get_authorized_session(self):
credentials = Credentials.from_authorized_user_file(self.token_cache_file, self.SCOPES)
with open(self.client_id_file) as fd:
data = json.load(fd)
if "web" in data:
data = data["web"]
elif "installed" in data:
data = data["installed"]

if credentials.client_id != data.get('client_id') or\
credentials.client_secret != data.get('client_secret'):
LOGGER.debug("Application key or secret has changed, store new token in file '%s'",
Expand Down

0 comments on commit 6116969

Please sign in to comment.