Skip to content

Commit

Permalink
fixed token refresh for oauth2
Browse files Browse the repository at this point in the history
  • Loading branch information
opaduchak committed Jan 9, 2025
1 parent 6865a6b commit 23311c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 8 additions & 8 deletions addon_service/common/known_imps.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ def get_imp_number(imp: type[AddonImp]) -> int:
class KnownAddonImps(enum.Enum):
"""Static mapping from API-facing name for an AddonImp to the Imp itself"""

BOX_DOT_COM = box_dot_com.BoxDotComStorageImp
BOX = box_dot_com.BoxDotComStorageImp
S3 = s3.S3StorageImp
ONEDRIVE = onedrive.OneDriveStorageImp
ZOTERO_ORG = zotero_org.ZoteroOrgCitationImp
GOOGLE_DRIVE = google_drive.GoogleDriveStorageImp
ZOTERO = zotero_org.ZoteroOrgCitationImp
GOOGLEDRIVE = google_drive.GoogleDriveStorageImp
FIGSHARE = figshare.FigshareStorageImp
MENDELEY = mendeley.MendeleyCitationImp
BITBUCKET = bitbucket.BitbucketStorageImp
DATAVERSE = dataverse.DataverseStorageImp
OWNCLOUD = owncloud.OwnCloudStorageImp

GIT_HUB = github.GitHubStorageImp
GITHUB = github.GitHubStorageImp
GITLAB = gitlab.GitlabStorageImp
DROPBOX = dropbox.DropboxStorageImp

Expand All @@ -95,11 +95,11 @@ class KnownAddonImps(enum.Enum):
class AddonImpNumbers(enum.Enum):
"""Static mapping from each AddonImp name to a unique integer (for database use)"""

BOX_DOT_COM = 1001
ZOTERO_ORG = 1002
BOX = 1001
ZOTERO = 1002
S3 = 1003
MENDELEY = 1004
GOOGLE_DRIVE = 1005
GOOGLEDRIVE = 1005
DROPBOX = 1006
FIGSHARE = 1007
ONEDRIVE = 1008
Expand All @@ -108,7 +108,7 @@ class AddonImpNumbers(enum.Enum):
GITLAB = 1011
BITBUCKET = 1012

GIT_HUB = 1013
GITHUB = 1013

BOA = 1020

Expand Down
4 changes: 1 addition & 3 deletions addon_service/common/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ async def _do_send(self, request: HttpRequestInfo):
async with self._try_send(request) as _response:
yield _response
except exceptions.ExpiredAccessToken:
await _PrivateNetworkInfo.get(
self
).account.refresh_oauth_access_token__async()
await _PrivateNetworkInfo.get(self).account.refresh_oauth2_access_token()
# if this one fails, don't try refreshing again
async with self._try_send(request) as _response:
yield _response
Expand Down

0 comments on commit 23311c7

Please sign in to comment.