-
Hi, I have no clue what happened between a week ago and yesterday but over that time something appears to have changed or broken. oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response. I have tried re-downloading the credential file, as well as creating a new credential, both of which resulted in the same error. I'm also unsure what to do to fix this error, or where I should report an issue if necessary. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi. Could you please share the code snippet that produces this and the whole traceback? |
Beta Was this translation helpful? Give feedback.
-
I am beyond confused, I re-ran the script to get a fresh traceback and it worked without issue. I changed nothing since my last run and it now all of the sudden works. Traceback (most recent call last):
File "C:\Fakepath\testcal_nuke.py", line 6, in _generate_calendar
return GoogleCalendar(id)
File "C:\Fakepath\lib\site-packages\gcsa\google_calendar.py", line 90, in __init__
self.credentials = self._get_credentials(
File "C:\Fakepath\lib\site-packages\gcsa\google_calendar.py", line 131, in _get_credentials
credentials = flow.run_local_server(host=host, port=port)
File "C:\Fakepath\lib\site-packages\google_auth_oauthlib\flow.py", line 477, in run_local_server
self.fetch_token(authorization_response=authorization_response)
File "C:\Fakepath\lib\site-packages\google_auth_oauthlib\flow.py", line 286, in fetch_token
return self.oauth2session.fetch_token(self.client_config["token_uri"], **kwargs)
File "C:\Fakepath\lib\site-packages\requests_oauthlib\oauth2_session.py", line 244, in fetch_token
self._client.parse_request_uri_response(
File "C:\Fakepath\lib\site-packages\oauthlib\oauth2\rfc6749\clients\web_application.py", line 220, in parse_request_uri_response
response = parse_authorization_code_response(uri, state=state)
File "C:\Fakepath\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 278, in parse_authorization_code_response
raise MismatchingStateError()
oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Fakepath\testcal_nuke.py", line 12, in <module>
calendar=_generate_calendar("<calendar id>@group.calendar.google.com")#,
File "C:\Fakepath\testcal_nuke.py", line 7, in _generate_calendar
except RefreshError as err:
NameError: name 'RefreshError' is not defined snippet: def _generate_calendar(id) -> GoogleCalendar:
try:
return GoogleCalendar(id)
except RefreshError as err:
os.remove("C:/Fakepath/.credentials/token.pickle")
print(f"Authentication token expired. Reauthenticating...")
return GoogleCalendar(id)
#...
calendar = _generate_calendar("<calendar id>@group.calendar.google.com")#, Thank you for your help and for maintaining this library. Very appreciated. |
Beta Was this translation helpful? Give feedback.
Hi. Could you please share the code snippet that produces this and the whole traceback?