From 67de6be9751eee6724c9c0cf35246c31a20d24d0 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Fri, 17 May 2024 07:49:46 +0200 Subject: [PATCH] # Fix * fixes bug where oauth requests did not use https in dockered deployment environment --- konova/views/oauth.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/konova/views/oauth.py b/konova/views/oauth.py index 58f4685..94dee2d 100644 --- a/konova/views/oauth.py +++ b/konova/views/oauth.py @@ -18,6 +18,7 @@ from django.utils.timezone import now from django.views import View from api.models import OAuthToken +from konova.sub_settings.django_settings import BASE_URL from konova.sub_settings.sso_settings import SSO_SERVER_BASE, OAUTH_CODE_VERIFIER, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET @@ -62,6 +63,8 @@ class OAuthLoginView(View): """ oauth_authentication_code_url = f"{SSO_SERVER_BASE}o/authorize/" + redirect_uri = f'{BASE_URL}{reverse("oauth-callback")}' + code_verifier, code_challenge = self.__create_code_challenge() urlencode_params = urlencode( @@ -70,11 +73,7 @@ class OAuthLoginView(View): "code_challenge": code_challenge, "code_challenge_method": "S256", "client_id": OAUTH_CLIENT_ID, - "redirect_uri": request.build_absolute_uri( - reverse( - "oauth-callback" - ) - ), + "redirect_uri": redirect_uri, } ) url = f"{oauth_authentication_code_url}?{urlencode_params}"