Skip to content

Commit

Permalink
fix: add "verify" flag to the creation of client
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks authored Jun 1, 2024
2 parents 5d433fe + e3862b9 commit 12f2396
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions supabase_auth/_async/gotrue_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ def __init__(
url: str = "",
headers: Dict[str, str] = {},
http_client: Union[AsyncClient, None] = None,
verify: bool = True,
) -> None:
AsyncGoTrueBaseAPI.__init__(
self,
url=url,
headers=headers,
http_client=http_client,
verify=verify,
)
self.mfa = AsyncGoTrueAdminMFAAPI()
self.mfa.list_factors = self._list_factors
Expand Down
3 changes: 2 additions & 1 deletion supabase_auth/_async/gotrue_base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ def __init__(
url: str,
headers: Dict[str, str],
http_client: Union[AsyncClient, None],
verify: bool = True,
):
self._url = url
self._headers = headers
self._http_client = http_client or AsyncClient()
self._http_client = http_client or AsyncClient(verify=bool(verify))

async def __aenter__(self) -> Self:
return self
Expand Down
2 changes: 2 additions & 0 deletions supabase_auth/_async/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ def __init__(
storage: Union[AsyncSupportedStorage, None] = None,
http_client: Union[AsyncClient, None] = None,
flow_type: AuthFlowType = "implicit",
verify: bool = True,
) -> None:
AsyncGoTrueBaseAPI.__init__(
self,
url=url or GOTRUE_URL,
headers=headers or DEFAULT_HEADERS,
http_client=http_client,
verify=verify,
)
self._storage_key = storage_key or STORAGE_KEY
self._auto_refresh_token = auto_refresh_token
Expand Down
3 changes: 2 additions & 1 deletion supabase_auth/_sync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ def __init__(
headers: Dict[str, str],
cookie_options: CookieOptions,
http_client: Optional[SyncClient] = None,
verify: bool = True,
) -> None:
"""Initialise API class."""
self.url = url
self.headers = headers
self.cookie_options = cookie_options
self.http_client = http_client or SyncClient()
self.http_client = http_client or SyncClient(verify=bool(verify))

def __enter__(self) -> SyncGoTrueAPI:
return self
Expand Down
4 changes: 4 additions & 0 deletions supabase_auth/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS),
api: Optional[SyncGoTrueAPI] = None,
replace_default_headers: bool = False,
verify: bool = True,
) -> None:
"""Create a new client
Expand All @@ -54,6 +55,8 @@ def __init__(
The storage engine to use for persisting the session.
cookie_options : CookieOptions
The options for the cookie.
verify: bool
Verify SSL, True by default, False disables verification.
"""
if url.startswith("http://"):
print(
Expand All @@ -72,6 +75,7 @@ def __init__(
"url": url,
"headers": {**empty_or_default_headers, **headers},
"cookie_options": cookie_options,
"verify": verify,
}
self.api = api or SyncGoTrueAPI(**args)

Expand Down
2 changes: 2 additions & 0 deletions supabase_auth/_sync/gotrue_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ def __init__(
url: str = "",
headers: Dict[str, str] = {},
http_client: Union[SyncClient, None] = None,
verify: bool = True,
) -> None:
SyncGoTrueBaseAPI.__init__(
self,
url=url,
headers=headers,
http_client=http_client,
verify=verify,
)
self.mfa = SyncGoTrueAdminMFAAPI()
self.mfa.list_factors = self._list_factors
Expand Down
3 changes: 2 additions & 1 deletion supabase_auth/_sync/gotrue_base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ def __init__(
url: str,
headers: Dict[str, str],
http_client: Union[SyncClient, None],
verify: bool = True,
):
self._url = url
self._headers = headers
self._http_client = http_client or SyncClient()
self._http_client = http_client or SyncClient(verify=bool(verify))

def __enter__(self) -> Self:
return self
Expand Down
2 changes: 2 additions & 0 deletions supabase_auth/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ def __init__(
storage: Union[SyncSupportedStorage, None] = None,
http_client: Union[SyncClient, None] = None,
flow_type: AuthFlowType = "implicit",
verify: bool = True,
) -> None:
SyncGoTrueBaseAPI.__init__(
self,
url=url or GOTRUE_URL,
headers=headers or DEFAULT_HEADERS,
http_client=http_client,
verify=verify,
)
self._storage_key = storage_key or STORAGE_KEY
self._auto_refresh_token = auto_refresh_token
Expand Down

0 comments on commit 12f2396

Please sign in to comment.