From 67a2fbc26b340a0f014085be11a6999067397c95 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Sun, 15 Dec 2024 18:42:04 -0500 Subject: [PATCH 1/2] fix zotero --- osf/external/gravy_valet/translations.py | 2 +- website/oauth/views.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osf/external/gravy_valet/translations.py b/osf/external/gravy_valet/translations.py index cccabddfad0..c65a66d97ae 100644 --- a/osf/external/gravy_valet/translations.py +++ b/osf/external/gravy_valet/translations.py @@ -38,7 +38,7 @@ class _LegacyConfigsForWBKey(enum.Enum): onedrive = OneDriveAddonAppConfig owncloud = OwnCloudAddonAppConfig s3 = S3AddonAppConfig - zotero = ZoteroAddonAppConfig + zotero_org = ZoteroAddonAppConfig mendeley = MendeleyAddonConfig diff --git a/website/oauth/views.py b/website/oauth/views.py index afc5b66bceb..c83ec31cccc 100644 --- a/website/oauth/views.py +++ b/website/oauth/views.py @@ -73,9 +73,14 @@ def oauth_callback(service_name, auth): def _forward_to_addon_service(oauth_version): code = request.args.get('code') state = request.args.get('state') + oauth_token = request.args.get('oauth_token') + oauth_verifier = request.args.get('oauth_verifier') query_params = { 'code': code, 'state': state, + 'oauth_token': oauth_token, + 'oauth_verifier': oauth_verifier, } + gv_url = urlunparse(urlparse(GRAVYVALET_URL)._replace(path=f'/v1/{oauth_version}/callback', query=urlencode(query_params))) - requests.get(gv_url) + requests.get(gv_url, cookies=request.cookies) From abccfc5966922808e3b1472ff6c27a08b2d30a2b Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Mon, 16 Dec 2024 22:42:19 -0500 Subject: [PATCH 2/2] fix tests --- addons/base/tests/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/base/tests/views.py b/addons/base/tests/views.py index 06143e06191..f330f179b0f 100644 --- a/addons/base/tests/views.py +++ b/addons/base/tests/views.py @@ -82,6 +82,8 @@ def test_oauth_finish_enable_gv(self, mock_requests_get): query_params = { 'code': 'somecode', 'state': 'somestatetoken', + 'oauth_token': 'someoauthtoken', + 'oauth_verifier': 'someverifier', } with override_flag(ENABLE_GV, active=True): request_url = urlunparse(urlparse(url)._replace(query=urlencode(query_params)))