Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

Commit 233695a

Browse files
committed
Fix relative URL getter (again)
1 parent 105943e commit 233695a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fief_client/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import uuid
44
from enum import Enum
55
from typing import Any, Dict, List, Mapping, Optional, Tuple, TypedDict, Union
6-
from urllib.parse import urlencode
6+
from urllib.parse import urlencode, urlsplit, urlunsplit
77

88
import httpx
99
from httpx._types import CertTypes, VerifyTypes
@@ -253,8 +253,10 @@ def _get_endpoint_url(
253253
rather stick to the host specified on the client configuration.
254254
"""
255255
if not absolute:
256-
issuer = openid_configuration["issuer"]
257-
return openid_configuration[field].split(issuer)[1]
256+
(scheme, netloc, *components) = urlsplit(self.base_url)
257+
host = self.host if self.host is not None else netloc
258+
host_base_url = urlunsplit((scheme, host, *components))
259+
return openid_configuration[field].split(host_base_url)[1]
258260
return openid_configuration[field]
259261

260262
def _auth_url(

0 commit comments

Comments
 (0)