Skip to content

Commit 36d6fe8

Browse files
authored
remove cookies parameter on do_post and do_get (#23)
* remove cookies paramter on do_post and do_get * adjust tests
1 parent 910e8e7 commit 36d6fe8

File tree

16 files changed

+13
-30
lines changed

16 files changed

+13
-30
lines changed

descope/auth.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,13 @@ def __init__(self, project_id: str, public_key: str = None, base_uri: str = None
5959
def do_get(
6060
self,
6161
uri: str,
62-
cookies=None,
6362
params=None,
6463
allow_redirects=None,
6564
pswd: str = None,
6665
) -> requests.Response:
6766
response = requests.get(
6867
f"{self.base_url}{uri}",
6968
headers=self._get_default_headers(pswd),
70-
cookies=cookies,
7169
params=params,
7270
allow_redirects=allow_redirects,
7371
)
@@ -77,14 +75,11 @@ def do_get(
7775
)
7876
return response
7977

80-
def do_post(
81-
self, uri: str, body: dict, cookies=None, pswd: str = None
82-
) -> requests.Response:
78+
def do_post(self, uri: str, body: dict, pswd: str = None) -> requests.Response:
8379
response = requests.post(
8480
f"{self.base_url}{uri}",
8581
headers=self._get_default_headers(pswd),
8682
data=json.dumps(body),
87-
cookies=cookies,
8883
)
8984
if not response.ok:
9085
raise AuthException(
@@ -305,7 +300,7 @@ def _get_default_headers(self, pswd: str = None):
305300

306301
def _refresh_token(self, refresh_token: str) -> dict:
307302
uri = Auth._compose_refresh_token_url()
308-
response = self.do_get(uri, None, None, None, refresh_token)
303+
response = self.do_get(uri, None, None, refresh_token)
309304

310305
resp = response.json()
311306
auth_info = self._generate_auth_info(

descope/authmethod/exchanger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def exchange_token(self, code: str) -> dict:
2020

2121
uri = EndpointsV1.exchangeTokenPath
2222
params = Exchanger._compose_exchange_params(code)
23-
response = self._auth.do_get(uri, None, params, False)
23+
response = self._auth.do_get(uri, params, False)
2424
resp = response.json()
2525
jwt_response = self._auth._generate_jwt_response(
2626
resp, response.cookies.get(REFRESH_SESSION_COOKIE_NAME, None)

descope/authmethod/magiclink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def _update_user_email(
151151
identifier, email, cross_device
152152
)
153153
uri = EndpointsV1.updateUserEmailOTPPath
154-
return self._auth.do_post(uri, body, None, refresh_token)
154+
return self._auth.do_post(uri, body, refresh_token)
155155

156156
def _update_user_phone(
157157
self,
@@ -172,7 +172,7 @@ def _update_user_phone(
172172
identifier, phone, cross_device
173173
)
174174
uri = EndpointsV1.updateUserPhoneOTPPath
175-
return self._auth.do_post(uri, body, None, refresh_token)
175+
return self._auth.do_post(uri, body, refresh_token)
176176

177177
@staticmethod
178178
def _compose_signin_url(method: DeliveryMethod) -> str:

descope/authmethod/oauth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def start(self, provider: str, return_url: str = "") -> dict:
1919

2020
uri = EndpointsV1.oauthStart
2121
params = OAuth._compose_start_params(provider, return_url)
22-
response = self._auth.do_get(uri, None, params, False)
22+
response = self._auth.do_get(uri, params, False)
2323

2424
return response.json()
2525

descope/authmethod/otp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def update_user_email(
154154

155155
uri = EndpointsV1.updateUserEmailOTPPath
156156
body = OTP._compose_update_user_email_body(identifier, email)
157-
self._auth.do_post(uri, body, None, refresh_token)
157+
self._auth.do_post(uri, body, refresh_token)
158158

159159
def update_user_phone(
160160
self, method: DeliveryMethod, identifier: str, phone: str, refresh_token: str
@@ -185,7 +185,7 @@ def update_user_phone(
185185

186186
uri = OTP._compose_update_phone_url(method)
187187
body = OTP._compose_update_user_phone_body(identifier, phone)
188-
self._auth.do_post(uri, body, None, refresh_token)
188+
self._auth.do_post(uri, body, refresh_token)
189189

190190
@staticmethod
191191
def _compose_signup_url(method: DeliveryMethod) -> str:

descope/authmethod/saml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def start(self, tenant: str, return_url: str = None) -> dict:
2424

2525
uri = EndpointsV1.authSAMLStart
2626
params = SAML._compose_start_params(tenant, return_url)
27-
response = self._auth.do_get(uri, None, params)
27+
response = self._auth.do_get(uri, params)
2828

2929
return response.json()
3030

descope/authmethod/totp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def update_user(self, identifier: str, refresh_token: str) -> None:
7272

7373
uri = EndpointsV1.updateTOTPPath
7474
body = TOTP._compose_update_user_body(identifier)
75-
response = self._auth.do_post(uri, body, None, refresh_token)
75+
response = self._auth.do_post(uri, body, refresh_token)
7676

7777
return response.json()
7878
# Response should have these schema:

descope/authmethod/webauthn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def add_device_start(self, identifier: str, refresh_token: str, origin: str):
113113

114114
uri = EndpointsV1.deviceAddAuthWebauthnStart
115115
body = WebauthN._compose_add_device_start_body(identifier, origin)
116-
response = self._auth.do_post(uri, body, None, refresh_token)
116+
response = self._auth.do_post(uri, body, refresh_token)
117117

118118
return response.json()
119119

descope/descope_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ def logout(self, refresh_token: str) -> requests.Response:
9494
)
9595

9696
uri = EndpointsV1.logoutPath
97-
return self._auth.do_get(uri, None, None, None, refresh_token)
97+
return self._auth.do_get(uri, None, None, refresh_token)

samples/webauthn_web_sample_app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def webauthn_add_device_start():
8787
def webauthn_add_device_finish():
8888
data = request.get_json()
8989
descope_client.webauthn.add_device_finish(data["transactionId"], data["response"])
90+
return jsonify("{}")
9091

9192

9293
if __name__ == "__main__":

0 commit comments

Comments
 (0)