Skip to content

Commit

Permalink
feat: skip http redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
joel authored and joel committed Jan 17, 2024
1 parent 72eeb1e commit 8dca4a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion gotrue/_async/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ async def sign_in_with_sso(self, credentials: SignInWithSSOCredentials):
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
captcha_token = options.get("captcha_token")
skip_http_redirects = options.get("skip_http_redirects", True)
if domain:
return await self._request(
"POST",
Expand All @@ -271,7 +272,10 @@ async def sign_in_with_sso(self, credentials: SignInWithSSOCredentials):
if provider_id:
return await self._request(
"POST" "sso",
body={"provider_id": provider_id},
body={
"provider_id": provider_id,
"skip_http_redirect": skip_http_redirects,
},
redirect_to=redirect_to,
xform=parse_auth_response,
)
Expand Down
1 change: 0 additions & 1 deletion gotrue/_sync/gotrue_base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def _request(
)
response.raise_for_status()
result = response if no_resolve_json else response.json()
print(response)
if xform:
return xform(result)
except Exception as e:
Expand Down
6 changes: 5 additions & 1 deletion gotrue/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def sign_in_with_sso(self, credentials: SignInWithSSOCredentials):
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
captcha_token = options.get("captcha_token")
skip_http_redirects = options.get("skip_http_redirects", True)
if domain:
return self._request(
"POST",
Expand All @@ -271,7 +272,10 @@ def sign_in_with_sso(self, credentials: SignInWithSSOCredentials):
if provider_id:
return self._request(
"POST" "sso",
body={"provider_id": provider_id},
body={
"provider_id": provider_id,
"skip_http_redirect": skip_http_redirects,
},
redirect_to=redirect_to,
xform=parse_auth_response,
)
Expand Down
1 change: 1 addition & 0 deletions gotrue/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ class SignInWithOAuthCredentials(TypedDict):
class SignInWithSSOCredentials(TypedDict):
provider_id: NotRequired[str]
domain: NotRequired[str]
skip_http_redirect: NotRequired[str]
options: NotRequired[SignInWithSSOOptions]


Expand Down

0 comments on commit 8dca4a5

Please sign in to comment.