diff --git a/supertokens_python/ingredients/emaildelivery/types.py b/supertokens_python/ingredients/emaildelivery/types.py index afea599c3..09897c346 100644 --- a/supertokens_python/ingredients/emaildelivery/types.py +++ b/supertokens_python/ingredients/emaildelivery/types.py @@ -24,9 +24,7 @@ class EmailDeliveryInterface(ABC, Generic[_T]): @abstractmethod - async def send_email( - self, template_vars: _T, tenant_id: str, user_context: Dict[str, Any] - ) -> None: + async def send_email(self, template_vars: _T, user_context: Dict[str, Any]) -> None: pass diff --git a/supertokens_python/ingredients/smsdelivery/types.py b/supertokens_python/ingredients/smsdelivery/types.py index 67c843a8b..b8ad046cd 100644 --- a/supertokens_python/ingredients/smsdelivery/types.py +++ b/supertokens_python/ingredients/smsdelivery/types.py @@ -22,9 +22,7 @@ class SMSDeliveryInterface(ABC, Generic[_T]): @abstractmethod - async def send_sms( - self, template_vars: _T, tenant_id: str, user_context: Dict[str, Any] - ) -> None: + async def send_sms(self, template_vars: _T, user_context: Dict[str, Any]) -> None: pass diff --git a/supertokens_python/recipe/dashboard/api/userdetails/user_email_verify_token_post.py b/supertokens_python/recipe/dashboard/api/userdetails/user_email_verify_token_post.py index 30534283a..a390d94fd 100644 --- a/supertokens_python/recipe/dashboard/api/userdetails/user_email_verify_token_post.py +++ b/supertokens_python/recipe/dashboard/api/userdetails/user_email_verify_token_post.py @@ -70,7 +70,7 @@ async def handle_email_verify_token_post( VerificationEmailTemplateVars( user=VerificationEmailTemplateVarsUser(user_id, email_response.email), email_verify_link=email_verify_link, - user_context={}, + tenant_id=tenant_id, ) ) diff --git a/supertokens_python/recipe/emailpassword/api/implementation.py b/supertokens_python/recipe/emailpassword/api/implementation.py index 42d2601c1..82c967c43 100644 --- a/supertokens_python/recipe/emailpassword/api/implementation.py +++ b/supertokens_python/recipe/emailpassword/api/implementation.py @@ -111,9 +111,10 @@ async def generate_password_reset_token_post( send_email_input = PasswordResetEmailTemplateVars( user=PasswordResetEmailTemplateVarsUser(user.user_id, user.email), password_reset_link=password_reset_link, + tenant_id=tenant_id, ) await api_options.email_delivery.ingredient_interface_impl.send_email( - send_email_input, tenant_id, user_context + send_email_input, user_context ) return GeneratePasswordResetTokenPostOkResult() diff --git a/supertokens_python/recipe/emailpassword/asyncio/__init__.py b/supertokens_python/recipe/emailpassword/asyncio/__init__.py index 80d18dece..1804cac58 100644 --- a/supertokens_python/recipe/emailpassword/asyncio/__init__.py +++ b/supertokens_python/recipe/emailpassword/asyncio/__init__.py @@ -110,11 +110,10 @@ async def sign_up( async def send_email( input_: EmailTemplateVars, - tenant_id: str, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} return await EmailPasswordRecipe.get_instance().email_delivery.ingredient_interface_impl.send_email( - input_, tenant_id, user_context + input_, user_context ) diff --git a/supertokens_python/recipe/emailpassword/emaildelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/emailpassword/emaildelivery/services/backward_compatibility/__init__.py index 1ad652350..59abf5dad 100644 --- a/supertokens_python/recipe/emailpassword/emaildelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/emailpassword/emaildelivery/services/backward_compatibility/__init__.py @@ -89,7 +89,6 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: user = await self.recipe_interface_impl.get_user_by_id( diff --git a/supertokens_python/recipe/emailpassword/emaildelivery/services/smtp/__init__.py b/supertokens_python/recipe/emailpassword/emaildelivery/services/smtp/__init__.py index f950ca2ca..977468175 100644 --- a/supertokens_python/recipe/emailpassword/emaildelivery/services/smtp/__init__.py +++ b/supertokens_python/recipe/emailpassword/emaildelivery/services/smtp/__init__.py @@ -44,7 +44,6 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: content = await self.service_implementation.get_content( diff --git a/supertokens_python/recipe/emailpassword/syncio/__init__.py b/supertokens_python/recipe/emailpassword/syncio/__init__.py index a8bf2b4f4..ae1ecd5c5 100644 --- a/supertokens_python/recipe/emailpassword/syncio/__init__.py +++ b/supertokens_python/recipe/emailpassword/syncio/__init__.py @@ -104,9 +104,8 @@ def sign_up( def send_email( input_: EmailTemplateVars, - tenant_id: str, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.emailpassword.asyncio import send_email - return sync(send_email(input_, tenant_id, user_context)) + return sync(send_email(input_, user_context)) diff --git a/supertokens_python/recipe/emailpassword/types.py b/supertokens_python/recipe/emailpassword/types.py index 4f73b7070..371f289a3 100644 --- a/supertokens_python/recipe/emailpassword/types.py +++ b/supertokens_python/recipe/emailpassword/types.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. from __future__ import annotations -from typing import Awaitable, Callable, List, TypeVar, Union +from typing import Awaitable, Callable, List, TypeVar, Union, Optional from supertokens_python.ingredients.emaildelivery import EmailDeliveryIngredient from supertokens_python.ingredients.emaildelivery.types import ( @@ -99,9 +99,11 @@ def __init__( self, user: PasswordResetEmailTemplateVarsUser, password_reset_link: str, + tenant_id: Optional[str], ) -> None: self.user = user self.password_reset_link = password_reset_link + self.tenant_id = tenant_id # Export: diff --git a/supertokens_python/recipe/emailverification/asyncio/__init__.py b/supertokens_python/recipe/emailverification/asyncio/__init__.py index 0b903a2c7..9e9036a7c 100644 --- a/supertokens_python/recipe/emailverification/asyncio/__init__.py +++ b/supertokens_python/recipe/emailverification/asyncio/__init__.py @@ -138,11 +138,10 @@ async def unverify_email( async def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} return await EmailVerificationRecipe.get_instance().email_delivery.ingredient_interface_impl.send_email( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) diff --git a/supertokens_python/recipe/emailverification/emaildelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/emailverification/emaildelivery/services/backward_compatibility/__init__.py index 73d5ccec5..0c2ac4506 100644 --- a/supertokens_python/recipe/emailverification/emaildelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/emailverification/emaildelivery/services/backward_compatibility/__init__.py @@ -68,7 +68,6 @@ def __init__( async def send_email( self, template_vars: VerificationEmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: try: diff --git a/supertokens_python/recipe/emailverification/emaildelivery/services/smtp/__init__.py b/supertokens_python/recipe/emailverification/emaildelivery/services/smtp/__init__.py index 7584408dd..4878110d8 100644 --- a/supertokens_python/recipe/emailverification/emaildelivery/services/smtp/__init__.py +++ b/supertokens_python/recipe/emailverification/emaildelivery/services/smtp/__init__.py @@ -43,7 +43,6 @@ def __init__( async def send_email( self, template_vars: VerificationEmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: content = await self.service_implementation.get_content( diff --git a/supertokens_python/recipe/emailverification/recipe.py b/supertokens_python/recipe/emailverification/recipe.py index d647b2246..9f7b3ce58 100644 --- a/supertokens_python/recipe/emailverification/recipe.py +++ b/supertokens_python/recipe/emailverification/recipe.py @@ -460,10 +460,10 @@ async def generate_email_verify_token_post( email_verification_email_delivery_input = VerificationEmailTemplateVars( user=VerificationEmailTemplateVarsUser(user_id, email_info.email), email_verify_link=email_verify_link, - user_context=user_context, + tenant_id=tenant_id, ) await api_options.email_delivery.ingredient_interface_impl.send_email( - email_verification_email_delivery_input, tenant_id, user_context + email_verification_email_delivery_input, user_context ) return GenerateEmailVerifyTokenPostOkResult() diff --git a/supertokens_python/recipe/emailverification/syncio/__init__.py b/supertokens_python/recipe/emailverification/syncio/__init__.py index 5575fca7e..155479b55 100644 --- a/supertokens_python/recipe/emailverification/syncio/__init__.py +++ b/supertokens_python/recipe/emailverification/syncio/__init__.py @@ -35,7 +35,7 @@ def create_email_verification_token( def verify_email_using_token( token: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.emailverification.asyncio import ( @@ -82,9 +82,8 @@ def unverify_email( def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.emailverification.asyncio import send_email - return sync(send_email(input_, tenant_id, user_context)) + return sync(send_email(input_, user_context)) diff --git a/supertokens_python/recipe/emailverification/types.py b/supertokens_python/recipe/emailverification/types.py index d60580a20..43b6f671c 100644 --- a/supertokens_python/recipe/emailverification/types.py +++ b/supertokens_python/recipe/emailverification/types.py @@ -13,7 +13,7 @@ # under the License. from __future__ import annotations -from typing import Union, Dict, Any +from typing import Union, Optional from supertokens_python.ingredients.emaildelivery import EmailDeliveryIngredient from supertokens_python.ingredients.emaildelivery.types import ( @@ -39,11 +39,11 @@ def __init__( self, user: VerificationEmailTemplateVarsUser, email_verify_link: str, - user_context: Dict[str, Any], + tenant_id: Optional[str], ) -> None: self.user = user self.email_verify_link = email_verify_link - self.user_context = user_context + self.tenant_id = tenant_id # Export: diff --git a/supertokens_python/recipe/passwordless/api/implementation.py b/supertokens_python/recipe/passwordless/api/implementation.py index 51bc29b5c..b17215a3b 100644 --- a/supertokens_python/recipe/passwordless/api/implementation.py +++ b/supertokens_python/recipe/passwordless/api/implementation.py @@ -98,9 +98,10 @@ async def create_code_post( url_with_link_code=magic_link, code_life_time=response.code_life_time, pre_auth_session_id=response.pre_auth_session_id, + tenant_id=tenant_id, ) await api_options.email_delivery.ingredient_interface_impl.send_email( - passwordless_email_delivery_input, tenant_id, user_context + passwordless_email_delivery_input, user_context ) elif isinstance( api_options.config.contact_config, @@ -115,9 +116,10 @@ async def create_code_post( url_with_link_code=magic_link, code_life_time=response.code_life_time, pre_auth_session_id=response.pre_auth_session_id, + tenant_id=tenant_id, ) await api_options.sms_delivery.ingredient_interface_impl.send_sms( - sms_input, tenant_id, user_context + sms_input, user_context ) return CreateCodePostOkResult( @@ -214,10 +216,11 @@ async def resend_code_post( url_with_link_code=magic_link, code_life_time=response.code_life_time, pre_auth_session_id=response.pre_auth_session_id, + tenant_id=tenant_id, ) ) await api_options.email_delivery.ingredient_interface_impl.send_email( - passwordless_email_delivery_input, tenant_id, user_context + passwordless_email_delivery_input, user_context ) elif isinstance( api_options.config.contact_config, @@ -234,9 +237,10 @@ async def resend_code_post( url_with_link_code=magic_link, code_life_time=response.code_life_time, pre_auth_session_id=response.pre_auth_session_id, + tenant_id=tenant_id, ) await api_options.sms_delivery.ingredient_interface_impl.send_sms( - sms_input, tenant_id, user_context + sms_input, user_context ) return ResendCodePostOkResult() return ResendCodePostRestartFlowError() diff --git a/supertokens_python/recipe/passwordless/asyncio/__init__.py b/supertokens_python/recipe/passwordless/asyncio/__init__.py index a2bbafc94..16b7523c9 100644 --- a/supertokens_python/recipe/passwordless/asyncio/__init__.py +++ b/supertokens_python/recipe/passwordless/asyncio/__init__.py @@ -133,7 +133,7 @@ async def get_user_by_email( async def get_user_by_phone_number( phone_number: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[User, None]: if user_context is None: @@ -246,7 +246,7 @@ async def list_codes_by_phone_number( async def list_codes_by_device_id( device_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[DeviceType, None]: if user_context is None: @@ -260,7 +260,7 @@ async def list_codes_by_device_id( async def list_codes_by_pre_auth_session_id( pre_auth_session_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[DeviceType, None]: if user_context is None: @@ -306,23 +306,27 @@ async def signinup( async def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} + if input_.tenant_id is None: + input_.tenant_id = DEFAULT_TENANT_ID + return await PasswordlessRecipe.get_instance().email_delivery.ingredient_interface_impl.send_email( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) async def send_sms( input_: SMSTemplateVars, - tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} + if input_.tenant_id is None: + input_.tenant_id = DEFAULT_TENANT_ID + return await PasswordlessRecipe.get_instance().sms_delivery.ingredient_interface_impl.send_sms( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) diff --git a/supertokens_python/recipe/passwordless/emaildelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/passwordless/emaildelivery/services/backward_compatibility/__init__.py index 435ff9f43..d23d74819 100644 --- a/supertokens_python/recipe/passwordless/emaildelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/passwordless/emaildelivery/services/backward_compatibility/__init__.py @@ -88,7 +88,6 @@ def __init__( async def send_email( self, template_vars: PasswordlessLoginEmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: await self.create_and_send_custom_email( diff --git a/supertokens_python/recipe/passwordless/emaildelivery/services/smtp/__init__.py b/supertokens_python/recipe/passwordless/emaildelivery/services/smtp/__init__.py index b4e0d2448..d391e94ef 100644 --- a/supertokens_python/recipe/passwordless/emaildelivery/services/smtp/__init__.py +++ b/supertokens_python/recipe/passwordless/emaildelivery/services/smtp/__init__.py @@ -45,7 +45,6 @@ def __init__( async def send_email( self, template_vars: PasswordlessLoginEmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: content = await self.service_implementation.get_content( diff --git a/supertokens_python/recipe/passwordless/smsdelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/passwordless/smsdelivery/services/backward_compatibility/__init__.py index 23c267f81..3fd136409 100644 --- a/supertokens_python/recipe/passwordless/smsdelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/passwordless/smsdelivery/services/backward_compatibility/__init__.py @@ -110,7 +110,6 @@ def __init__( async def send_sms( self, template_vars: PasswordlessLoginSMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: await self.create_and_send_custom_sms( diff --git a/supertokens_python/recipe/passwordless/smsdelivery/services/supertokens/__init__.py b/supertokens_python/recipe/passwordless/smsdelivery/services/supertokens/__init__.py index 289e1116f..a25be8d0e 100644 --- a/supertokens_python/recipe/passwordless/smsdelivery/services/supertokens/__init__.py +++ b/supertokens_python/recipe/passwordless/smsdelivery/services/supertokens/__init__.py @@ -34,7 +34,6 @@ def __init__(self, api_key: str) -> None: async def send_sms( self, template_vars: PasswordlessLoginSMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: supertokens = Supertokens.get_instance() diff --git a/supertokens_python/recipe/passwordless/smsdelivery/services/twilio/__init__.py b/supertokens_python/recipe/passwordless/smsdelivery/services/twilio/__init__.py index aa2c633f1..6cf2448de 100644 --- a/supertokens_python/recipe/passwordless/smsdelivery/services/twilio/__init__.py +++ b/supertokens_python/recipe/passwordless/smsdelivery/services/twilio/__init__.py @@ -56,7 +56,6 @@ def __init__( async def send_sms( self, template_vars: PasswordlessLoginSMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: content = await self.service_implementation.get_content( diff --git a/supertokens_python/recipe/passwordless/syncio/__init__.py b/supertokens_python/recipe/passwordless/syncio/__init__.py index d68ef3235..fc44c828f 100644 --- a/supertokens_python/recipe/passwordless/syncio/__init__.py +++ b/supertokens_python/recipe/passwordless/syncio/__init__.py @@ -112,7 +112,7 @@ def get_user_by_email( def get_user_by_phone_number( phone_number: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[User, None]: return sync( @@ -195,7 +195,7 @@ def list_codes_by_phone_number( def list_codes_by_device_id( device_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[DeviceType, None]: return sync( @@ -207,7 +207,7 @@ def list_codes_by_device_id( def list_codes_by_pre_auth_session_id( pre_auth_session_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[DeviceType, None]: return sync( @@ -222,7 +222,7 @@ def list_codes_by_pre_auth_session_id( def create_magic_link( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> str: return sync( @@ -238,7 +238,7 @@ def create_magic_link( def signinup( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> ConsumeCodeOkResult: return sync( @@ -253,15 +253,13 @@ def signinup( def send_email( input_: PasswordlessLoginEmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ) -> None: - return sync(asyncio.send_email(input_, tenant_id, user_context)) + return sync(asyncio.send_email(input_, user_context)) def send_sms( input_: PasswordlessLoginSMSTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ) -> None: - return sync(asyncio.send_sms(input_, tenant_id, user_context)) + return sync(asyncio.send_sms(input_, user_context)) diff --git a/supertokens_python/recipe/passwordless/types.py b/supertokens_python/recipe/passwordless/types.py index 23727c317..00f63279c 100644 --- a/supertokens_python/recipe/passwordless/types.py +++ b/supertokens_python/recipe/passwordless/types.py @@ -82,12 +82,14 @@ def __init__( email: str, user_input_code: Union[str, None] = None, url_with_link_code: Union[str, None] = None, + tenant_id: Union[str, None] = None, ): - self.email: str = email - self.code_life_time: int = code_life_time - self.pre_auth_session_id: str = pre_auth_session_id - self.user_input_code: Union[str, None] = user_input_code - self.url_with_link_code: Union[str, None] = url_with_link_code + self.email = email + self.code_life_time = code_life_time + self.pre_auth_session_id = pre_auth_session_id + self.user_input_code = user_input_code + self.url_with_link_code = url_with_link_code + self.tenant_id = tenant_id PasswordlessLoginEmailTemplateVars = CreateAndSendCustomEmailParameters @@ -101,12 +103,14 @@ def __init__( phone_number: str, user_input_code: Union[str, None] = None, url_with_link_code: Union[str, None] = None, + tenant_id: Union[str, None] = None, ): - self.code_life_time: int = code_life_time - self.pre_auth_session_id: str = pre_auth_session_id - self.phone_number: str = phone_number - self.user_input_code: Union[str, None] = user_input_code - self.url_with_link_code: Union[str, None] = url_with_link_code + self.code_life_time = code_life_time + self.pre_auth_session_id = pre_auth_session_id + self.phone_number = phone_number + self.user_input_code = user_input_code + self.url_with_link_code = url_with_link_code + self.tenant_id = tenant_id PasswordlessLoginSMSTemplateVars = CreateAndSendCustomTextMessageParameters diff --git a/supertokens_python/recipe/session/asyncio/__init__.py b/supertokens_python/recipe/session/asyncio/__init__.py index 779e6b3ed..e90b4a9c1 100644 --- a/supertokens_python/recipe/session/asyncio/__init__.py +++ b/supertokens_python/recipe/session/asyncio/__init__.py @@ -107,7 +107,7 @@ async def create_new_session_without_request_response( final_access_token_payload = {**access_token_payload, "iss": issuer} for claim in claims_added_by_other_recipes: - update = await claim.build(user_id, "pass-tenant-id", user_context) + update = await claim.build(user_id, tenant_id, user_context) final_access_token_payload = {**final_access_token_payload, **update} return await SessionRecipe.get_instance().recipe_implementation.create_new_session( @@ -426,9 +426,7 @@ async def revoke_session( async def revoke_all_sessions_for_user( - user_id: str, - tenant_id: Optional[str], - user_context: Union[None, Dict[str, Any]] = None, + user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None ) -> List[str]: if user_context is None: user_context = {} diff --git a/supertokens_python/recipe/session/session_request_functions.py b/supertokens_python/recipe/session/session_request_functions.py index b0678834d..0756a0204 100644 --- a/supertokens_python/recipe/session/session_request_functions.py +++ b/supertokens_python/recipe/session/session_request_functions.py @@ -239,8 +239,7 @@ async def create_new_session_in_request( final_access_token_payload = {**access_token_payload, "iss": issuer} for claim in claims_added_by_other_recipes: - # TODO: Pass tenant id - update = await claim.build(user_id, "pass-tenant-id", user_context) + update = await claim.build(user_id, tenant_id, user_context) final_access_token_payload = {**final_access_token_payload, **update} log_debug_message("createNewSession: Access token payload built") diff --git a/supertokens_python/recipe/session/syncio/__init__.py b/supertokens_python/recipe/session/syncio/__init__.py index fc8798217..d3636641a 100644 --- a/supertokens_python/recipe/session/syncio/__init__.py +++ b/supertokens_python/recipe/session/syncio/__init__.py @@ -187,9 +187,7 @@ def revoke_session( def revoke_all_sessions_for_user( - user_id: str, - tenant_id: Optional[str], - user_context: Union[None, Dict[str, Any]] = None, + user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None ) -> List[str]: from supertokens_python.recipe.session.asyncio import ( revoke_all_sessions_for_user as async_revoke_all_sessions_for_user, @@ -199,9 +197,7 @@ def revoke_all_sessions_for_user( def get_all_session_handles_for_user( - user_id: str, - tenant_id: Optional[str], - user_context: Union[None, Dict[str, Any]] = None, + user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None ) -> List[str]: from supertokens_python.recipe.session.asyncio import ( get_all_session_handles_for_user as async_get_all_session_handles_for_user, diff --git a/supertokens_python/recipe/thirdparty/api/authorisation_url.py b/supertokens_python/recipe/thirdparty/api/authorisation_url.py index 8bc139786..3446bad12 100644 --- a/supertokens_python/recipe/thirdparty/api/authorisation_url.py +++ b/supertokens_python/recipe/thirdparty/api/authorisation_url.py @@ -66,7 +66,6 @@ async def handle_authorisation_url_api( result = await api_implementation.authorisation_url_get( provider=provider, redirect_uri_on_provider_dashboard=redirect_uri_on_provider_dashboard, - tenant_id=tenant_id, api_options=api_options, user_context=user_context, ) diff --git a/supertokens_python/recipe/thirdparty/api/implementation.py b/supertokens_python/recipe/thirdparty/api/implementation.py index 26a9a3edb..209519588 100644 --- a/supertokens_python/recipe/thirdparty/api/implementation.py +++ b/supertokens_python/recipe/thirdparty/api/implementation.py @@ -44,13 +44,11 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: APIOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: authorisation_url_info = await provider.get_authorisation_redirect_url( redirect_uri_on_provider_dashboard=redirect_uri_on_provider_dashboard, - tenant_id=tenant_id, user_context=user_context, ) diff --git a/supertokens_python/recipe/thirdparty/asyncio/__init__.py b/supertokens_python/recipe/thirdparty/asyncio/__init__.py index 6fe64e071..dfc1e84d6 100644 --- a/supertokens_python/recipe/thirdparty/asyncio/__init__.py +++ b/supertokens_python/recipe/thirdparty/asyncio/__init__.py @@ -33,7 +33,7 @@ async def get_user_by_id( async def get_users_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: if user_context is None: @@ -48,7 +48,7 @@ async def get_users_by_email( async def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -65,7 +65,7 @@ async def manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: diff --git a/supertokens_python/recipe/thirdparty/interfaces.py b/supertokens_python/recipe/thirdparty/interfaces.py index c2b88dce4..01b82ac24 100644 --- a/supertokens_python/recipe/thirdparty/interfaces.py +++ b/supertokens_python/recipe/thirdparty/interfaces.py @@ -207,7 +207,6 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: APIOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: diff --git a/supertokens_python/recipe/thirdparty/provider.py b/supertokens_python/recipe/thirdparty/provider.py index e1594268f..8005240c5 100644 --- a/supertokens_python/recipe/thirdparty/provider.py +++ b/supertokens_python/recipe/thirdparty/provider.py @@ -55,12 +55,10 @@ async def get_config_for_client_type( # pylint: disable=no-self-use async def get_authorisation_redirect_url( # pylint: disable=no-self-use self, redirect_uri_on_provider_dashboard: str, - tenant_id: str, user_context: Dict[str, Any], ) -> AuthorisationRedirect: _ = redirect_uri_on_provider_dashboard - __ = tenant_id - ___ = user_context + __ = user_context raise NotImplementedError() async def exchange_auth_code_for_oauth_tokens( # pylint: disable=no-self-use diff --git a/supertokens_python/recipe/thirdparty/providers/custom.py b/supertokens_python/recipe/thirdparty/providers/custom.py index 6fbf27c3e..72cff1291 100644 --- a/supertokens_python/recipe/thirdparty/providers/custom.py +++ b/supertokens_python/recipe/thirdparty/providers/custom.py @@ -230,7 +230,6 @@ async def get_config_for_client_type( async def get_authorisation_redirect_url( self, redirect_uri_on_provider_dashboard: str, - tenant_id: str, user_context: Dict[str, Any], ) -> AuthorisationRedirect: query_params: Dict[str, str] = { diff --git a/supertokens_python/recipe/thirdparty/syncio/__init__.py b/supertokens_python/recipe/thirdparty/syncio/__init__.py index 3f5ca2ddb..a342a336e 100644 --- a/supertokens_python/recipe/thirdparty/syncio/__init__.py +++ b/supertokens_python/recipe/thirdparty/syncio/__init__.py @@ -27,7 +27,9 @@ def get_user_by_id( def get_users_by_email( - email: str, tenant_id: str, user_context: Union[None, Dict[str, Any]] = None + email: str, + tenant_id: Optional[str] = None, + user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: from supertokens_python.recipe.thirdparty.asyncio import get_users_by_email @@ -37,7 +39,7 @@ def get_users_by_email( def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdparty.asyncio import ( @@ -55,7 +57,7 @@ def manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdparty.asyncio import ( diff --git a/supertokens_python/recipe/thirdpartyemailpassword/api/implementation.py b/supertokens_python/recipe/thirdpartyemailpassword/api/implementation.py index 889841e59..f4c9a673b 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/api/implementation.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/api/implementation.py @@ -227,14 +227,12 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: ThirdPartyApiOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: return await self.tp_authorisation_url_get( provider, redirect_uri_on_provider_dashboard, - tenant_id, api_options, user_context, ) diff --git a/supertokens_python/recipe/thirdpartyemailpassword/asyncio/__init__.py b/supertokens_python/recipe/thirdpartyemailpassword/asyncio/__init__.py index 454c61d59..d2409b23b 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/asyncio/__init__.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/asyncio/__init__.py @@ -35,7 +35,7 @@ async def get_user_by_id( async def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -52,7 +52,7 @@ async def thirdparty_manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -81,7 +81,7 @@ async def thirdparty_get_provider( async def create_reset_password_token( user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -94,7 +94,7 @@ async def create_reset_password_token( async def reset_password_using_token( token: str, new_password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -107,7 +107,7 @@ async def reset_password_using_token( async def emailpassword_sign_in( email: str, password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -120,7 +120,7 @@ async def emailpassword_sign_in( async def emailpassword_sign_up( email: str, password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -146,7 +146,7 @@ async def update_email_or_password( async def get_users_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: if user_context is None: @@ -158,11 +158,13 @@ async def get_users_by_email( async def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} + if input_.tenant_id is None: + input_.tenant_id = DEFAULT_TENANT_ID + return await ThirdPartyEmailPasswordRecipe.get_instance().email_delivery.ingredient_interface_impl.send_email( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) diff --git a/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/backward_compatibility/__init__.py index 8f97c3858..2d2298757 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/backward_compatibility/__init__.py @@ -51,9 +51,8 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: await self.ep_backward_compatiblity_service.send_email( - template_vars, tenant_id, user_context + template_vars, user_context ) diff --git a/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/smtp/__init__.py b/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/smtp/__init__.py index a67939643..d9167385c 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/smtp/__init__.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/emaildelivery/services/smtp/__init__.py @@ -40,7 +40,6 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: - await self.ep_smtp_service.send_email(template_vars, tenant_id, user_context) + await self.ep_smtp_service.send_email(template_vars, user_context) diff --git a/supertokens_python/recipe/thirdpartyemailpassword/interfaces.py b/supertokens_python/recipe/thirdpartyemailpassword/interfaces.py index ec6be177a..32125ea39 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/interfaces.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/interfaces.py @@ -8,7 +8,6 @@ from supertokens_python.recipe.thirdparty.provider import Provider, RedirectUriInfo from supertokens_python.recipe.thirdparty.types import RawUserInfoFromProvider from supertokens_python.types import APIResponse, GeneralErrorResponse -from supertokens_python.recipe.thirdparty import provider as TPProvider from .types import User @@ -54,11 +53,6 @@ ThirdPartyInterfaces.SignInUpPostNoEmailGivenByProviderResponse ) -ThirdpartyProviderInput = TPProvider.ProviderInput -ThirdpartyProviderConfig = TPProvider.ProviderConfig -ThirdpartyProviderClientConfig = TPProvider.ProviderClientConfig -ThirdpartyProviderConfigForClientType = TPProvider.ProviderConfigForClientType - class ThirdPartySignInUpOkResult: def __init__( @@ -285,7 +279,6 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: ThirdPartyAPIOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: diff --git a/supertokens_python/recipe/thirdpartyemailpassword/syncio/__init__.py b/supertokens_python/recipe/thirdpartyemailpassword/syncio/__init__.py index d042c0d5a..0d25968b4 100644 --- a/supertokens_python/recipe/thirdpartyemailpassword/syncio/__init__.py +++ b/supertokens_python/recipe/thirdpartyemailpassword/syncio/__init__.py @@ -34,7 +34,7 @@ def get_user_by_id( def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -52,7 +52,7 @@ def thirdparty_manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -83,7 +83,7 @@ def thirdparty_get_provider( def create_reset_password_token( user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -96,7 +96,7 @@ def create_reset_password_token( def reset_password_using_token( token: str, new_password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -111,7 +111,7 @@ def reset_password_using_token( def emailpassword_sign_in( email: str, password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[EmailPasswordSignInOkResult, EmailPasswordSignInWrongCredentialsError]: from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -124,7 +124,7 @@ def emailpassword_sign_in( def emailpassword_sign_up( email: str, password: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -154,7 +154,7 @@ def update_email_or_password( def get_users_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( @@ -166,9 +166,8 @@ def get_users_by_email( def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): from supertokens_python.recipe.thirdpartyemailpassword.asyncio import send_email - return sync(send_email(input_, tenant_id, user_context)) + return sync(send_email(input_, user_context)) diff --git a/supertokens_python/recipe/thirdpartypasswordless/api/implementation.py b/supertokens_python/recipe/thirdpartypasswordless/api/implementation.py index d77ed2049..2242220b3 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/api/implementation.py +++ b/supertokens_python/recipe/thirdpartypasswordless/api/implementation.py @@ -90,14 +90,12 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: ThirdPartyAPIOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: return await self.tp_authorisation_url_get( provider, redirect_uri_on_provider_dashboard, - tenant_id, api_options, user_context, ) diff --git a/supertokens_python/recipe/thirdpartypasswordless/asyncio/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/asyncio/__init__.py index b705b84b2..f48def8d1 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/asyncio/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/asyncio/__init__.py @@ -39,7 +39,7 @@ async def get_user_by_id( async def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -56,7 +56,7 @@ async def thirdparty_manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: @@ -85,7 +85,7 @@ async def thirdparty_get_provider( async def get_users_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: if user_context is None: @@ -160,7 +160,7 @@ async def consume_code( async def get_user_by_phone_number( phone_number: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[User, None]: if user_context is None: @@ -231,7 +231,7 @@ async def revoke_all_codes( async def revoke_code( code_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> interfaces.RevokeCodeOkResult: if user_context is None: @@ -245,7 +245,7 @@ async def revoke_code( async def list_codes_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[interfaces.DeviceType]: if user_context is None: @@ -257,7 +257,7 @@ async def list_codes_by_email( async def list_codes_by_phone_number( phone_number: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[interfaces.DeviceType]: if user_context is None: @@ -271,7 +271,7 @@ async def list_codes_by_phone_number( async def list_codes_by_device_id( device_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[interfaces.DeviceType, None]: if user_context is None: @@ -285,7 +285,7 @@ async def list_codes_by_device_id( async def list_codes_by_pre_auth_session_id( pre_auth_session_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[interfaces.DeviceType, None]: if user_context is None: @@ -300,7 +300,7 @@ async def list_codes_by_pre_auth_session_id( async def create_magic_link( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> str: if user_context is None: @@ -316,7 +316,7 @@ async def create_magic_link( async def passwordlessSigninup( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> interfaces.ConsumeCodeOkResult: if user_context is None: @@ -344,23 +344,27 @@ async def passwordlessSigninup( async def send_email( input_: EmailTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} + if input_.tenant_id is None: + input_.tenant_id = DEFAULT_TENANT_ID + return await ThirdPartyPasswordlessRecipe.get_instance().email_delivery.ingredient_interface_impl.send_email( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) async def send_sms( input_: SMSTemplateVars, - tenant_id: Optional[str], user_context: Union[None, Dict[str, Any]] = None, ): if user_context is None: user_context = {} + if input_.tenant_id is None: + input_.tenant_id = DEFAULT_TENANT_ID + return await ThirdPartyPasswordlessRecipe.get_instance().sms_delivery.ingredient_interface_impl.send_sms( - input_, tenant_id or DEFAULT_TENANT_ID, user_context + input_, user_context ) diff --git a/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/backward_compatibility/__init__.py index 380f34f7f..30e516d2e 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/backward_compatibility/__init__.py @@ -47,9 +47,8 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: await self.pless_backward_compatiblity_service.send_email( - template_vars, tenant_id, user_context + template_vars, user_context ) diff --git a/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/smtp/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/smtp/__init__.py index eaea53245..e18bc7092 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/smtp/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/emaildelivery/services/smtp/__init__.py @@ -52,9 +52,6 @@ def __init__( async def send_email( self, template_vars: EmailTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: - return await self.pless_smtp_service.send_email( - template_vars, tenant_id, user_context - ) + return await self.pless_smtp_service.send_email(template_vars, user_context) diff --git a/supertokens_python/recipe/thirdpartypasswordless/interfaces.py b/supertokens_python/recipe/thirdpartypasswordless/interfaces.py index ed4067d49..0e4780d02 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/interfaces.py +++ b/supertokens_python/recipe/thirdpartypasswordless/interfaces.py @@ -6,7 +6,6 @@ from supertokens_python.recipe.thirdparty.provider import Provider, RedirectUriInfo from supertokens_python.recipe.thirdparty.types import RawUserInfoFromProvider from supertokens_python.types import APIResponse, GeneralErrorResponse -from supertokens_python.recipe.thirdparty import provider as TPProvider from ..passwordless import interfaces as PlessInterfaces from .types import User @@ -67,11 +66,6 @@ ThirdPartyInterfaces.SignInUpPostNoEmailGivenByProviderResponse ) -ThirdpartyProviderInput = TPProvider.ProviderInput -ThirdpartyProviderConfig = TPProvider.ProviderConfig -ThirdpartyProviderClientConfig = TPProvider.ProviderClientConfig -ThirdpartyProviderConfigForClientType = TPProvider.ProviderConfigForClientType - class ConsumeCodeOkResult: def __init__(self, created_new_user: bool, user: User): @@ -332,7 +326,6 @@ async def authorisation_url_get( self, provider: Provider, redirect_uri_on_provider_dashboard: str, - tenant_id: str, api_options: ThirdPartyAPIOptions, user_context: Dict[str, Any], ) -> Union[AuthorisationUrlGetOkResult, GeneralErrorResponse]: diff --git a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/backward_compatibility/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/backward_compatibility/__init__.py index 7cc6a2665..3d1ba27cd 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/backward_compatibility/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/backward_compatibility/__init__.py @@ -46,9 +46,8 @@ def __init__( async def send_sms( self, template_vars: SMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: await self.pless_backward_compatibility_service.send_sms( - template_vars, tenant_id, user_context + template_vars, user_context ) diff --git a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/supertokens/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/supertokens/__init__.py index eacdd8f36..c8d90173d 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/supertokens/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/supertokens/__init__.py @@ -32,9 +32,6 @@ def __init__(self, api_key: str) -> None: async def send_sms( self, template_vars: SMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: - await self.pless_supertokens_service.send_sms( - template_vars, tenant_id, user_context - ) + await self.pless_supertokens_service.send_sms(template_vars, user_context) diff --git a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/twilio/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/twilio/__init__.py index a1f7ef47d..44e90967a 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/twilio/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/smsdelivery/services/twilio/__init__.py @@ -47,7 +47,6 @@ def __init__( async def send_sms( self, template_vars: SMSTemplateVars, - tenant_id: str, user_context: Dict[str, Any], ) -> None: - await self.pless_twilio_service.send_sms(template_vars, tenant_id, user_context) + await self.pless_twilio_service.send_sms(template_vars, user_context) diff --git a/supertokens_python/recipe/thirdpartypasswordless/syncio/__init__.py b/supertokens_python/recipe/thirdpartypasswordless/syncio/__init__.py index 2bd5fd10d..4273cf61c 100644 --- a/supertokens_python/recipe/thirdpartypasswordless/syncio/__init__.py +++ b/supertokens_python/recipe/thirdpartypasswordless/syncio/__init__.py @@ -35,7 +35,7 @@ def get_user_by_id( def get_user_by_third_party_info( third_party_id: str, third_party_user_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from ..asyncio import get_user_by_third_party_info @@ -51,7 +51,7 @@ def thirdparty_manually_create_or_update_user( third_party_id: str, third_party_user_id: str, email: str, - tenant_id: str, + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ): from ..asyncio import thirdparty_manually_create_or_update_user @@ -77,7 +77,9 @@ def thirdparty_get_provider( def get_users_by_email( - email: str, tenant_id: str, user_context: Union[None, Dict[str, Any]] = None + email: str, + tenant_id: Optional[str] = None, + user_context: Union[None, Dict[str, Any]] = None, ) -> List[User]: from ..asyncio import get_users_by_email @@ -148,7 +150,9 @@ def consume_code( def get_user_by_phone_number( - phone_number: str, tenant_id: str, user_context: Union[None, Dict[str, Any]] = None + phone_number: str, + tenant_id: Optional[str] = None, + user_context: Union[None, Dict[str, Any]] = None, ) -> Union[User, None]: return sync( asyncio.get_user_by_phone_number( @@ -214,7 +218,7 @@ def revoke_all_codes( def revoke_code( code_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> interfaces.RevokeCodeOkResult: return sync( @@ -226,7 +230,7 @@ def revoke_code( def list_codes_by_email( email: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> List[interfaces.DeviceType]: return sync( @@ -237,7 +241,9 @@ def list_codes_by_email( def list_codes_by_phone_number( - phone_number: str, tenant_id: str, user_context: Union[None, Dict[str, Any]] = None + phone_number: str, + tenant_id: Optional[str] = None, + user_context: Union[None, Dict[str, Any]] = None, ) -> List[interfaces.DeviceType]: return sync( asyncio.list_codes_by_phone_number( @@ -248,7 +254,7 @@ def list_codes_by_phone_number( def list_codes_by_device_id( device_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[interfaces.DeviceType, None]: return sync( @@ -260,7 +266,7 @@ def list_codes_by_device_id( def list_codes_by_pre_auth_session_id( pre_auth_session_id: str, - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> Union[interfaces.DeviceType, None]: return sync( @@ -275,7 +281,7 @@ def list_codes_by_pre_auth_session_id( def create_magic_link( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> str: return sync( @@ -291,7 +297,7 @@ def create_magic_link( def passwordlessSigninup( email: Union[str, None], phone_number: Union[str, None], - tenant_id: Optional[str], + tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None, ) -> interfaces.ConsumeCodeOkResult: return sync( @@ -306,15 +312,13 @@ def passwordlessSigninup( def send_email( input_: EmailTemplateVars, - tenant_id: str, user_context: Union[None, Dict[str, Any]] = None, ): - return sync(asyncio.send_email(input_, tenant_id, user_context)) + return sync(asyncio.send_email(input_, user_context)) def send_sms( input_: SMSTemplateVars, - tenant_id: str, user_context: Union[None, Dict[str, Any]] = None, ): - return sync(asyncio.send_sms(input_, tenant_id, user_context)) + return sync(asyncio.send_sms(input_, user_context)) diff --git a/tests/sessions/claims/test_create_new_session.py b/tests/sessions/claims/test_create_new_session.py index 9e038b817..bd0fb4703 100644 --- a/tests/sessions/claims/test_create_new_session.py +++ b/tests/sessions/claims/test_create_new_session.py @@ -31,7 +31,7 @@ async def test_create_access_token_payload_with_session_claims(timestamp: int): s = await create_new_session(dummy_req, "someId") payload = s.get_access_token_payload() - assert len(payload) == 9 + assert len(payload) == 10 assert payload["st-true"] == {"v": True, "t": timestamp} @@ -44,7 +44,7 @@ async def test_should_create_access_token_payload_with_session_claims_with_an_no s = await create_new_session(dummy_req, "someId") payload = s.get_access_token_payload() - assert len(payload) == 8 + assert len(payload) == 9 assert payload.get("st-true") is None diff --git a/tests/sessions/test_access_token_v3.py b/tests/sessions/test_access_token_v3.py index 701964a37..0ca1efc8e 100644 --- a/tests/sessions/test_access_token_v3.py +++ b/tests/sessions/test_access_token_v3.py @@ -21,7 +21,7 @@ pytestmark = pytest.mark.asyncio -async def test_access_token_v3(): +async def test_access_token_v4(): init(**get_st_init_args([session.init()])) # type:ignore start_st() @@ -39,6 +39,7 @@ async def test_access_token_v3(): False, ) assert res["userId"] == "user-id" + assert parsed_info.version == 4 async def test_parsing_access_token_v2():