astrojuanlu / meetup-checkin

3 stars 1 forks source link

Refresh token after expiration #7

Open astrojuanlu opened 1 year ago

astrojuanlu commented 1 year ago

Sometimes the backend produces errors like these:

oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

Unsure how to address this, because according to the flask_dance docs:

The OAuth dance normally only needs to be performed once per user. Once the consumer has an access token, that access token can be used to make many API requests on behalf of the user. Some OAuth implementations put a lifespan on the access token, after which it must be refreshed, but refreshing an access token does not require any interaction from the user.

A bit lost here, any help is very appreciated.

astrojuanlu commented 1 year ago

Me pasó otra vez:

ERROR:root:Error while registering checkin
Traceback (most recent call last):
File "/app/app.py", line 182, in checkin
resp = meetup.post(
File "/opt/venv/lib/python3.8/site-packages/requests/sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/flask_dance/consumer/requests.py", line 192, in request
return super().request(
File "/opt/venv/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 483, in request
url, headers, data = self._client.add_token(
File "/opt/venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 217, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
astrojuanlu commented 6 months ago

Otra vez.