Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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__('<PROVIDER_ID>', ProviderConfigForClient(
client_id='<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(
Expand All @@ -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="..."),
Expand Down Expand Up @@ -665,7 +661,7 @@ init(
},
token_endpoint="https://example.com/oauth/token",
),
override=get_custom_provider
override=override_custom_provider
),
]
^{pythonSignInUpFeatureEnd}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__('<PROVIDER_ID>', ProviderConfigForClient(
client_id='<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(
Expand All @@ -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="..."),
Expand Down Expand Up @@ -665,7 +661,7 @@ init(
},
token_endpoint="https://example.com/oauth/token",
),
override=get_custom_provider
override=override_custom_provider
),
]
^{pythonSignInUpFeatureEnd}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__('<PROVIDER_ID>', ProviderConfigForClient(
client_id='<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(
Expand All @@ -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="..."),
Expand Down Expand Up @@ -665,7 +661,7 @@ init(
},
token_endpoint="https://example.com/oauth/token",
),
override=get_custom_provider
override=override_custom_provider
),
]
^{pythonSignInUpFeatureEnd}
Expand Down