Skip to content

Commit 6185f42

Browse files
Merge pull request #67 from kinde-oss/fix/url-handling-improvements
fix: improve URL handling in portals authentication
2 parents c9c7be9 + 3557d59 commit 6185f42

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kinde_sdk/auth/portals.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Dict, Any, Optional
22
import logging
33
import urllib.parse
4-
from urllib.parse import urlparse, URL
4+
from urllib.parse import urlparse
55
import httpx
66
from enum import Enum
77
from kinde_sdk.core.framework.framework_factory import FrameworkFactory
@@ -60,7 +60,7 @@ def _sanitize_url(self, url: str) -> str:
6060
url = 'https://' + url
6161
return url.rstrip('/')
6262

63-
async def generate_portal_url(self, domain: str, return_url: str, sub_nav: PortalPage = PortalPage.PROFILE) -> Dict[str, URL]:
63+
async def generate_portal_url(self, domain: str, return_url: str, sub_nav: PortalPage = PortalPage.PROFILE) -> Dict[str, str]:
6464
"""
6565
Generates a URL to the user portal.
6666
@@ -115,8 +115,8 @@ async def generate_portal_url(self, domain: str, return_url: str, sub_nav: Porta
115115
raise Exception("Invalid URL received from API")
116116

117117
try:
118-
portal_url = URL(result["url"])
119-
return {"url": portal_url}
118+
portal_url = urlparse(result["url"])
119+
return {"url": result["url"]}
120120
except Exception as e:
121121
self._logger.error(f"Error parsing URL: {e}")
122122
raise Exception(f"Invalid URL format received from API: {result['url']}")

0 commit comments

Comments
 (0)