From 5f8ade2f62556a74e5d8b7d7d8f9209e9c4aa9a8 Mon Sep 17 00:00:00 2001 From: Hamish Moffatt Date: Tue, 18 Jun 2024 09:58:40 +1000 Subject: [PATCH] handle auth URL already containing query part --- pylti1p3/oidc_login.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylti1p3/oidc_login.py b/pylti1p3/oidc_login.py index 6d23e01..7a6574f 100644 --- a/pylti1p3/oidc_login.py +++ b/pylti1p3/oidc_login.py @@ -134,7 +134,10 @@ def _prepare_redirect_url(self, launch_url: str) -> str: # LTI message hint to identify LTI context within the platform auth_params["lti_message_hint"] = lti_message_hint - auth_login_return_url = auth_login_url + "?" + urlencode(auth_params) + if "?" in auth_login_url: + auth_login_return_url = auth_login_url + "&" + urlencode(auth_params) + else: + auth_login_return_url = auth_login_url + "?" + urlencode(auth_params) return auth_login_return_url def _prepare_redirect(self, launch_url: str) -> Redirect[RED]: