diff --git a/v2/thirdparty/common-customizations/sign-in-and-up/custom-providers.mdx b/v2/thirdparty/common-customizations/sign-in-and-up/custom-providers.mdx index 68c13c206..caa6adc0c 100644 --- a/v2/thirdparty/common-customizations/sign-in-and-up/custom-providers.mdx +++ b/v2/thirdparty/common-customizations/sign-in-and-up/custom-providers.mdx @@ -612,13 +612,9 @@ from supertokens_python.recipe.thirdparty.provider import ProviderClientConfig, from supertokens_python.recipe.thirdparty.types import UserInfo, UserInfoEmail, RawUserInfoFromProvider from typing import Dict, Any -class CustomProvider(Provider): - def __init__(self): - super().__init__('', ProviderConfigForClient( - client_id='', - )) - async def get_user_info(self, oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: +def override_custom_provider(provider: Provider) -> Provider: + async def get_user_info(oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: return UserInfo( third_party_user_id="...", email=UserInfoEmail( @@ -633,9 +629,9 @@ class CustomProvider(Provider): }, ), ) + provider.get_user_info = get_user_info + return provider -def get_custom_provider(provider: Provider) -> Provider: - return CustomProvider() init( app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."), @@ -665,7 +661,7 @@ init( }, token_endpoint="https://example.com/oauth/token", ), - override=get_custom_provider + override=override_custom_provider ), ] ^{pythonSignInUpFeatureEnd} diff --git a/v2/thirdpartyemailpassword/common-customizations/signup-form/custom-providers.mdx b/v2/thirdpartyemailpassword/common-customizations/signup-form/custom-providers.mdx index 68c13c206..caa6adc0c 100644 --- a/v2/thirdpartyemailpassword/common-customizations/signup-form/custom-providers.mdx +++ b/v2/thirdpartyemailpassword/common-customizations/signup-form/custom-providers.mdx @@ -612,13 +612,9 @@ from supertokens_python.recipe.thirdparty.provider import ProviderClientConfig, from supertokens_python.recipe.thirdparty.types import UserInfo, UserInfoEmail, RawUserInfoFromProvider from typing import Dict, Any -class CustomProvider(Provider): - def __init__(self): - super().__init__('', ProviderConfigForClient( - client_id='', - )) - async def get_user_info(self, oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: +def override_custom_provider(provider: Provider) -> Provider: + async def get_user_info(oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: return UserInfo( third_party_user_id="...", email=UserInfoEmail( @@ -633,9 +629,9 @@ class CustomProvider(Provider): }, ), ) + provider.get_user_info = get_user_info + return provider -def get_custom_provider(provider: Provider) -> Provider: - return CustomProvider() init( app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."), @@ -665,7 +661,7 @@ init( }, token_endpoint="https://example.com/oauth/token", ), - override=get_custom_provider + override=override_custom_provider ), ] ^{pythonSignInUpFeatureEnd} diff --git a/v2/thirdpartypasswordless/common-customizations/signup-form/custom-providers.mdx b/v2/thirdpartypasswordless/common-customizations/signup-form/custom-providers.mdx index 68c13c206..caa6adc0c 100644 --- a/v2/thirdpartypasswordless/common-customizations/signup-form/custom-providers.mdx +++ b/v2/thirdpartypasswordless/common-customizations/signup-form/custom-providers.mdx @@ -612,13 +612,9 @@ from supertokens_python.recipe.thirdparty.provider import ProviderClientConfig, from supertokens_python.recipe.thirdparty.types import UserInfo, UserInfoEmail, RawUserInfoFromProvider from typing import Dict, Any -class CustomProvider(Provider): - def __init__(self): - super().__init__('', ProviderConfigForClient( - client_id='', - )) - async def get_user_info(self, oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: +def override_custom_provider(provider: Provider) -> Provider: + async def get_user_info(oauth_tokens: Dict[str, Any], user_context: Dict[str, Any]) -> UserInfo: return UserInfo( third_party_user_id="...", email=UserInfoEmail( @@ -633,9 +629,9 @@ class CustomProvider(Provider): }, ), ) + provider.get_user_info = get_user_info + return provider -def get_custom_provider(provider: Provider) -> Provider: - return CustomProvider() init( app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."), @@ -665,7 +661,7 @@ init( }, token_endpoint="https://example.com/oauth/token", ), - override=get_custom_provider + override=override_custom_provider ), ] ^{pythonSignInUpFeatureEnd}