aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-12-18 17:34:47 -0600
committerzsloan2020-12-18 17:34:47 -0600
commitfc717c36d334f364bbae8c98f31ddf78e18d64e3 (patch)
tree3bc570a4c833187a414e3c7bc136bebce95f7920
parent69f92ef2bc10477a80eff96fb7cc83fee11f31e8 (diff)
downloadgenenetwork2-fc717c36d334f364bbae8c98f31ddf78e18d64e3.tar.gz
Added redirect_uri to the ORCID_AUTH_URL since it wasn't working due to missing this parameter
-rw-r--r--wqflask/utility/tools.py2
-rw-r--r--wqflask/wqflask/user_login.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 68ef0f04..65df59c3 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -267,7 +267,7 @@ ORCID_CLIENT_SECRET = get_setting('ORCID_CLIENT_SECRET')
ORCID_AUTH_URL = None
if ORCID_CLIENT_ID != 'UNKNOWN' and ORCID_CLIENT_SECRET:
ORCID_AUTH_URL = "https://orcid.org/oauth/authorize?response_type=code&scope=/authenticate&show_login=true&client_id=" + \
- ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET
+ ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET + "&redirect_uri=" + GN2_BRANCH_URL + "n/login/orcid_oauth2"
ORCID_TOKEN_URL = get_setting('ORCID_TOKEN_URL')
ELASTICSEARCH_HOST = get_setting('ELASTICSEARCH_HOST')
diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py
index b6266b2a..bc608e84 100644
--- a/wqflask/wqflask/user_login.py
+++ b/wqflask/wqflask/user_login.py
@@ -25,7 +25,7 @@ from utility.logger import getLogger
logger = getLogger(__name__)
from smtplib import SMTP
-from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD, LOG_SQL_ALCHEMY
+from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD, LOG_SQL_ALCHEMY, GN2_BRANCH_URL
THREE_DAYS = 60 * 60 * 24 * 3
@@ -277,9 +277,11 @@ def orcid_oauth2():
data = {
"client_id": ORCID_CLIENT_ID,
"client_secret": ORCID_CLIENT_SECRET,
- "grant_type": "authorization_code",
+ "grant_type": "authorization_code",
+ "redirect_uri": GN2_BRANCH_URL + "n/login/orcid_oauth2",
"code": code
}
+
result = requests.post(ORCID_TOKEN_URL, data=data)
result_dict = json.loads(result.text.encode("utf-8"))