kinde-python-sdk 1.2.8__py3-none-any.whl → 1.2.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kinde-python-sdk
3
- Version: 1.2.8
3
+ Version: 1.2.9
4
4
  Summary: Connect your app to the Kinde platform
5
5
  Author-email: Kinde Engineering <engineering@kinde.com>
6
6
  Project-URL: Homepage, https://github.com/kinde-oss/kinde-python-sdk
@@ -2,7 +2,7 @@ kinde_sdk/__init__.py,sha256=cBbmyFIDIH3kIYStgbhPnRJgsfe1EGa9_kLnimT4m7k,726
2
2
  kinde_sdk/api_client.py,sha256=ofpdNwrQxXPFlv5KRisoPOXDta9K_Eg_IbD2hwLjAE8,58495
3
3
  kinde_sdk/configuration.py,sha256=oqZGvKEf4kNNURbI1pip2ZVVcDyRTSmmnjXWziH4s80,15765
4
4
  kinde_sdk/exceptions.py,sha256=1rFuvc5vj6ZjnT_m1yd_vCyFROfV_4ytcmFrj3rg1jw,4736
5
- kinde_sdk/kinde_api_client.py,sha256=G5jZLahs3GqFFza5c-JnrXkBiwXFIaBWMUN5v6rH1gc,19160
5
+ kinde_sdk/kinde_api_client.py,sha256=FgFYIx46tjwFn4XmwqfDHzzM6Xt1dz_Y0rypsIumZGI,18818
6
6
  kinde_sdk/rest.py,sha256=HKfSGwlWNMRgB8wrT0u__2K-ZNFSSmAyBBFLH-dCilM,10552
7
7
  kinde_sdk/schemas.py,sha256=PC7NB7JscfXesOxq2TyddRb_3N2gqSZGUjsCKP3_7RU,97655
8
8
  kinde_sdk/apis/__init__.py,sha256=RTosXhMn41tMsKPUjIy-VK-_efOWzhkKiuGggJ3A6E0,214
@@ -582,8 +582,8 @@ kinde_sdk/test/test_models/test_user_profile_v2.py,sha256=QltYLnrMdUUM_rw6Fg5Nyw
582
582
  kinde_sdk/test/test_models/test_users.py,sha256=IGWziLNMAJbamUqoQxvcQKKd5G1D5Gp1sns9fdhxLt4,526
583
583
  kinde_sdk/test/test_models/test_users_response.py,sha256=ZHgkFH98bHU1JLIGh7R7MU4XfEqPY3QnkRiHZ2eLqmg,858
584
584
  kinde_sdk/test/test_models/test_webhook.py,sha256=9iZ6FjNBEA-rPbO1Deq0qonOkVp-ANoxFt0__O8COqg,533
585
- kinde_python_sdk-1.2.8.dist-info/LICENSE,sha256=iT6AIO6NJn_mo0kDD5mpz2zp9GpzH6YdhqOmkCBg-kQ,1385
586
- kinde_python_sdk-1.2.8.dist-info/METADATA,sha256=btNLaoqmgB2q-4M_mgeBriTd8v91h-37vt31BJiKde0,1961
587
- kinde_python_sdk-1.2.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
588
- kinde_python_sdk-1.2.8.dist-info/top_level.txt,sha256=Tx4AaXvRSme43PIec8zPL_lCo02AWIRBG8JADU0GedQ,10
589
- kinde_python_sdk-1.2.8.dist-info/RECORD,,
585
+ kinde_python_sdk-1.2.9.dist-info/LICENSE,sha256=iT6AIO6NJn_mo0kDD5mpz2zp9GpzH6YdhqOmkCBg-kQ,1385
586
+ kinde_python_sdk-1.2.9.dist-info/METADATA,sha256=hrkr9mMfiDDmQ_HfQAi80Y2qg3PyPPQ7m7Zb7xiWiI8,1961
587
+ kinde_python_sdk-1.2.9.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
588
+ kinde_python_sdk-1.2.9.dist-info/top_level.txt,sha256=Tx4AaXvRSme43PIec8zPL_lCo02AWIRBG8JADU0GedQ,10
589
+ kinde_python_sdk-1.2.9.dist-info/RECORD,,
@@ -137,7 +137,8 @@ class KindeApiClient(ApiClient):
137
137
  def is_authenticated_token(self, token_value: dict) -> dict:
138
138
  if token_value:
139
139
  if token_value.is_expired():
140
- return self._refresh_token_value(token_value)
140
+ self._refresh_token_value(token_value)
141
+ return True
141
142
  return None
142
143
 
143
144
  def create_org(self) -> str:
@@ -335,32 +336,26 @@ class KindeApiClient(ApiClient):
335
336
  raise KindeTokenException(f"Token {token_name} doesn't exist.")
336
337
 
337
338
  def _decode_token_if_needed_value(self, token_name: str, token_value: dict) -> dict:
338
- if token_name not in token_value:
339
- if not token_value:
340
- raise KindeTokenException(
341
- "Access token doesn't exist.\n"
342
- "When grant_type is CLIENT_CREDENTIALS use fetch_token().\n"
343
- 'For other grant_type use "get_login_url()" or "get_register_url()".'
344
- )
345
- token = token_value.get(token_name)
339
+ token = token_value.get(token_name)
346
340
 
347
- signing_key = self.jwks_client.get_signing_key_from_jwt(token)
341
+ if not isinstance(token, str):
342
+ return token_value
348
343
 
349
- if token:
350
- decode_token_params = {
351
- "jwt":token,
352
- "key": signing_key.key,
353
- "algorithms":["RS256"],
354
- "options":{
355
- "verify_signature": True,
356
- "verify_exp": True,
357
- "verify_aud": False
358
- }
344
+ signing_key = self.jwks_client.get_signing_key_from_jwt(token)
345
+ if signing_key:
346
+ decode_token_params = {
347
+ "jwt":token,
348
+ "key": signing_key.key,
349
+ "algorithms":["RS256"],
350
+ "options":{
351
+ "verify_signature": True,
352
+ "verify_exp": True,
353
+ "verify_aud": False
359
354
  }
360
- return jwt.decode(**decode_token_params)
361
- else:
362
- raise KindeTokenException(f"Token {token_name} doesn't exist.")
363
- return token_value
355
+ }
356
+ return {token_name: jwt.decode(**decode_token_params)}
357
+ else:
358
+ raise KindeTokenException(f"Token {token_name} doesn't exist.")
364
359
 
365
360
  def fetch_token(self, authorization_response: Optional[str] = None) -> None:
366
361
  if self.grant_type == GrantType.CLIENT_CREDENTIALS: