Skip to content

Commit 96f6424

Browse files
committed
WIP: add support for refresh tokens
Uncomment the code when inveniosoftware/invenio-oauthclient#328 is merged
1 parent 430d956 commit 96f6424

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

invenio_vcs/providers.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,18 @@ def remote_token(self):
234234
if self._access_token is not None:
235235
return self._access_token
236236

237-
return RemoteToken.get(self.user_id, self.factory.remote.consumer_key)
237+
token = RemoteToken.get(self.user_id, self.factory.remote.consumer_key)
238+
239+
# TODO: uncomment this when https://github.com/inveniosoftware/invenio-oauthclient/pull/328 is merged
240+
"""
241+
if token is None:
242+
return None
243+
244+
if token.is_expired():
245+
token.refresh_access_token()
246+
"""
247+
248+
return token
238249

239250
@cached_property
240251
def webhook_url(self):

0 commit comments

Comments
 (0)