Skip to content

Commit

Permalink
Merge branch 'feat/tp-rework' into refactor/user-context
Browse files Browse the repository at this point in the history
  • Loading branch information
KShivendu committed Jul 20, 2023
2 parents 43a9fa1 + 86b02a9 commit 1c8eb52
Show file tree
Hide file tree
Showing 55 changed files with 1,748 additions and 1,058 deletions.
4 changes: 2 additions & 2 deletions coreDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
"versions": [
"2.21"
"3.0"
]
}
}
115 changes: 72 additions & 43 deletions examples/with-django/with-thirdpartyemailpassword/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
session,
thirdpartyemailpassword,
)
from supertokens_python.recipe.thirdpartyemailpassword import (
Apple,
Discord,
Github,
Google,
GoogleWorkspaces,
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -72,46 +65,82 @@ def get_website_domain():
emailverification.init("REQUIRED"),
thirdpartyemailpassword.init(
providers=[
Google(
is_default=True,
client_id=os.environ.get("GOOGLE_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
),
Google(
client_id=os.environ.get("GOOGLE_CLIENT_ID_MOBILE"), # type: ignore
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET_MOBILE"), # type: ignore
),
Github(
is_default=True,
client_id=os.environ.get("GITHUB_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GITHUB_CLIENT_SECRET"), # type: ignore
),
Github(
client_id=os.environ.get("GITHUB_CLIENT_ID_MOBILE"), # type: ignore
client_secret=os.environ.get("GITHUB_CLIENT_SECRET_MOBILE"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="google",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_CLIENT_ID"],
client_secret=os.environ["GOOGLE_CLIENT_SECRET"],
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_CLIENT_ID_MOBILE"],
client_secret=os.environ["GOOGLE_CLIENT_SECRET_MOBILE"],
),
],
),
),
Apple(
is_default=True,
client_id=os.environ.get("APPLE_CLIENT_ID"), # type: ignore
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="github",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GITHUB_CLIENT_ID"],
client_secret=os.environ["GITHUB_CLIENT_SECRET"],
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GITHUB_CLIENT_ID_MOBILE"],
client_secret=os.environ["GITHUB_CLIENT_SECRET_MOBILE"],
),
],
)
),
Apple(
client_id=os.environ.get("APPLE_CLIENT_ID_MOBILE"), # type: ignore
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="apple",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["APPLE_CLIENT_ID"],
additional_config={
"keyId": os.environ["APPLE_KEY_ID"],
"teamId": os.environ["APPLE_TEAM_ID"],
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
},
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["APPLE_CLIENT_ID_MOBILE"],
additional_config={
"keyId": os.environ["APPLE_KEY_ID"],
"teamId": os.environ["APPLE_TEAM_ID"],
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
},
),
],
)
),
GoogleWorkspaces(
is_default=True,
client_id=os.environ.get("GOOGLE_WORKSPACES_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GOOGLE_WORKSPACES_CLIENT_SECRET"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="googleworkspaces",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_WORKSPACES_CLIENT_ID"],
client_secret=os.environ[
"GOOGLE_WORKSPACES_CLIENT_SECRET"
],
),
],
)
),
Discord(
is_default=True,
client_id=os.environ.get("DISCORD_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("DISCORD_CLIENT_SECRET"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="discord",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["DISCORD_CLIENT_ID"],
client_secret=os.environ["DISCORD_CLIENT_SECRET"],
),
],
)
),
]
),
Expand Down
116 changes: 73 additions & 43 deletions examples/with-fastapi/with-thirdpartyemailpassword/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@
)
from supertokens_python.recipe.session import SessionContainer
from supertokens_python.recipe.session.framework.fastapi import verify_session
from supertokens_python.recipe.thirdpartyemailpassword import (
Apple,
Discord,
Github,
Google,
GoogleWorkspaces,
)


load_dotenv()

Expand Down Expand Up @@ -62,46 +56,82 @@ def get_website_domain():
emailverification.init("REQUIRED"),
thirdpartyemailpassword.init(
providers=[
Google(
is_default=True,
client_id=os.environ.get("GOOGLE_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
),
Google(
client_id=os.environ.get("GOOGLE_CLIENT_ID_MOBILE"), # type: ignore
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
),
Github(
is_default=True,
client_id=os.environ.get("GITHUB_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GITHUB_CLIENT_SECRET"), # type: ignore
),
Github(
client_id=os.environ.get("GITHUB_CLIENT_ID_MOBILE"), # type: ignore
client_secret=os.environ.get("GITHUB_CLIENT_SECRET_MOBILE"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="google",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_CLIENT_ID"],
client_secret=os.environ["GOOGLE_CLIENT_SECRET"],
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_CLIENT_ID_MOBILE"],
client_secret=os.environ["GOOGLE_CLIENT_SECRET_MOBILE"],
),
],
),
),
Apple(
is_default=True,
client_id=os.environ.get("APPLE_CLIENT_ID"), # type: ignore
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="github",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GITHUB_CLIENT_ID"],
client_secret=os.environ["GITHUB_CLIENT_SECRET"],
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GITHUB_CLIENT_ID_MOBILE"],
client_secret=os.environ["GITHUB_CLIENT_SECRET_MOBILE"],
),
],
)
),
Apple(
client_id=os.environ.get("APPLE_CLIENT_ID_MOBILE"), # type: ignore
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="apple",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["APPLE_CLIENT_ID"],
additional_config={
"keyId": os.environ["APPLE_KEY_ID"],
"teamId": os.environ["APPLE_TEAM_ID"],
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
},
),
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["APPLE_CLIENT_ID_MOBILE"],
additional_config={
"keyId": os.environ["APPLE_KEY_ID"],
"teamId": os.environ["APPLE_TEAM_ID"],
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
},
),
],
)
),
GoogleWorkspaces(
is_default=True,
client_id=os.environ.get("GOOGLE_WORKSPACES_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("GOOGLE_WORKSPACES_CLIENT_SECRET"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="googleworkspaces",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["GOOGLE_WORKSPACES_CLIENT_ID"],
client_secret=os.environ[
"GOOGLE_WORKSPACES_CLIENT_SECRET"
],
),
],
)
),
Discord(
is_default=True,
client_id=os.environ.get("DISCORD_CLIENT_ID"), # type: ignore
client_secret=os.environ.get("DISCORD_CLIENT_SECRET"), # type: ignore
thirdpartyemailpassword.ProviderInput(
config=thirdpartyemailpassword.ProviderConfig(
third_party_id="discord",
clients=[
thirdpartyemailpassword.ProviderClientConfig(
client_id=os.environ["DISCORD_CLIENT_ID"],
client_secret=os.environ["DISCORD_CLIENT_SECRET"],
),
],
)
),
]
),
Expand Down
Loading

0 comments on commit 1c8eb52

Please sign in to comment.