chilli-axe / mpc-autofill

Print automation software (leveraging MakePlayingCards) for your tabletop gaming community
https://mpcautofill.github.io
GNU General Public License v3.0
206 stars 93 forks source link

Can't use the tool... "invalid_grant" #239

Open 0Merx opened 3 months ago

0Merx commented 3 months ago

System

Afflicted Components

Description

I followed the guide on the website, and i've used the tool before, but now it will not work. Whenever i try to run the tool it tells me "invalid_grant: Invalid JWT"

Steps to Reproduce

Random, I have no idea what's causing this

image

I'm not sure on how to post the xml file here, it won't let me, but this is the error

Traceback (most recent call last):
  File "autofill.py", line 160, in main
  File "src\order.py", line 572, in from_xmls_in_folder
  File "src\order.py", line 572, in <listcomp>
  File "src\order.py", line 537, in from_file_path
  File "src\order.py", line 514, in from_element
  File "src\order.py", line 280, in from_element
  File "<attrs generated init src.order.CardImage>", line 13, in __init__
    self.__attrs_post_init__()
  File "src\order.py", line 108, in __attrs_post_init__
  File "src\order.py", line 75, in generate_file_path
  File "src\order.py", line 59, in retrieve_card_name
  File "src\io.py", line 118, in get_google_drive_file_name
  File "ratelimit\decorators.py", line 113, in wrapper
  File "ratelimit\decorators.py", line 80, in wrapper
  File "src\io.py", line 41, in execute_google_drive_api_call
  File "googleapiclient\_helpers.py", line 130, in positional_wrapper
  File "googleapiclient\http.py", line 923, in execute
  File "googleapiclient\http.py", line 191, in _retry_request
  File "oauth2client\transport.py", line 159, in new_request
  File "oauth2client\client.py", line 749, in _refresh
  File "oauth2client\client.py", line 819, in _do_refresh_request
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim.
ndepaola commented 3 months ago

howdy - thanks for letting me know about this. i haven't seen anyone else report this issue so it might be isolated to your machine, but i'll test it out later tonight.

i'm wondering if it might be related to your machine's environment variables like in this thread https://stackoverflow.com/questions/67852810/why-am-i-getting-invalid-grant-invalid-jwt-signature-with-googles-python-tts - have you used google's cloud APIs before by setting the env var mentioned in the thread?

0Merx commented 3 months ago

so i have fixed the problem, it seems like the time and date of my computer (or anyone's) must be in-sync and "correct". what determines if it is correct or not, i have no idea. i live in cst, but my computer time is 1 hour behind my actual time, so i had changed the time settings to be correct for me. that was apparently causing the problem, since setting my time and date to be set automatically, the tool runs fine.

https://stackoverflow.com/questions/48056381/google-client-invalid-jwt-token-must-be-a-short-lived-token

ndepaola commented 3 months ago

nice find! glad you figured it out - i've added a debugging section to the wiki and included a section for this issue which links back to this thread.

going to close this as there's not much i can do for supporting computers w/ out of sync system clocks in the google drive api.

ndepaola commented 2 months ago

this has caught a few people on discord out - i'll look at adding a more readable error message guiding the user to check their system clock