Skip to content

fix: Linters errors and format #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 11, 2023
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