@@ -18,14 +18,16 @@ def __init__(
1818 client_secret : str ,
1919 scope : str | None = None ,
2020 timeout : float = 10.0 ,
21+ verify_ssl : bool = True ,
2122 ):
2223 super ().__init__ ()
23- self ._discovery = OidcDiscoveryClient (base_url , timeout )
24+ self ._discovery = OidcDiscoveryClient (base_url , timeout , verify_ssl = verify_ssl )
2425 self ._client_id = client_id
2526 self ._client_secret = client_secret
2627 self ._scope = scope
2728 self ._timeout = timeout
2829 self ._token : AccessToken | None = None
30+ self ._verify_ssl = verify_ssl
2931
3032 async def get_token (self ) -> AccessToken :
3133 if self ._token and self ._token .is_valid ():
@@ -53,7 +55,9 @@ async def _authenticate(self) -> AccessToken:
5355 if self ._scope :
5456 data ["scope" ] = self ._scope
5557
56- async with httpx .AsyncClient (timeout = self ._timeout ) as client :
58+ async with httpx .AsyncClient (
59+ timeout = self ._timeout , verify = self ._verify_ssl
60+ ) as client :
5761 r = await client .post (cfg .token_endpoint , data = data )
5862 r .raise_for_status ()
5963 payload = r .json ()
@@ -69,7 +73,9 @@ async def _refresh(self, refresh_token: str) -> AccessToken:
6973 "client_secret" : self ._client_secret ,
7074 }
7175
72- async with httpx .AsyncClient (timeout = self ._timeout ) as client :
76+ async with httpx .AsyncClient (
77+ timeout = self ._timeout , verify = self ._verify_ssl
78+ ) as client :
7379 r = await client .post (cfg .token_endpoint , data = data )
7480 r .raise_for_status ()
7581 payload = r .json ()
0 commit comments