Skip to content

Commit 5635006

Browse files
committed
Merge branch 'feat/multitenancy-claims' into refactor/user-context
2 parents 43a9fa1 + a0b8529 commit 5635006

File tree

55 files changed

+1720
-1058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1720
-1058
lines changed

coreDriverInterfaceSupported.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
33
"versions": [
4-
"2.21"
4+
"3.0"
55
]
6-
}
6+
}

examples/with-django/with-thirdpartyemailpassword/project/settings.py

Lines changed: 72 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
session,
3030
thirdpartyemailpassword,
3131
)
32-
from supertokens_python.recipe.thirdpartyemailpassword import (
33-
Apple,
34-
Discord,
35-
Github,
36-
Google,
37-
GoogleWorkspaces,
38-
)
3932

4033
# Build paths inside the project like this: BASE_DIR / 'subdir'.
4134
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -72,46 +65,82 @@ def get_website_domain():
7265
emailverification.init("REQUIRED"),
7366
thirdpartyemailpassword.init(
7467
providers=[
75-
Google(
76-
is_default=True,
77-
client_id=os.environ.get("GOOGLE_CLIENT_ID"), # type: ignore
78-
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
79-
),
80-
Google(
81-
client_id=os.environ.get("GOOGLE_CLIENT_ID_MOBILE"), # type: ignore
82-
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET_MOBILE"), # type: ignore
83-
),
84-
Github(
85-
is_default=True,
86-
client_id=os.environ.get("GITHUB_CLIENT_ID"), # type: ignore
87-
client_secret=os.environ.get("GITHUB_CLIENT_SECRET"), # type: ignore
88-
),
89-
Github(
90-
client_id=os.environ.get("GITHUB_CLIENT_ID_MOBILE"), # type: ignore
91-
client_secret=os.environ.get("GITHUB_CLIENT_SECRET_MOBILE"), # type: ignore
68+
thirdpartyemailpassword.ProviderInput(
69+
config=thirdpartyemailpassword.ProviderConfig(
70+
third_party_id="google",
71+
clients=[
72+
thirdpartyemailpassword.ProviderClientConfig(
73+
client_id=os.environ["GOOGLE_CLIENT_ID"],
74+
client_secret=os.environ["GOOGLE_CLIENT_SECRET"],
75+
),
76+
thirdpartyemailpassword.ProviderClientConfig(
77+
client_id=os.environ["GOOGLE_CLIENT_ID_MOBILE"],
78+
client_secret=os.environ["GOOGLE_CLIENT_SECRET_MOBILE"],
79+
),
80+
],
81+
),
9282
),
93-
Apple(
94-
is_default=True,
95-
client_id=os.environ.get("APPLE_CLIENT_ID"), # type: ignore
96-
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
97-
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
98-
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
83+
thirdpartyemailpassword.ProviderInput(
84+
config=thirdpartyemailpassword.ProviderConfig(
85+
third_party_id="github",
86+
clients=[
87+
thirdpartyemailpassword.ProviderClientConfig(
88+
client_id=os.environ["GITHUB_CLIENT_ID"],
89+
client_secret=os.environ["GITHUB_CLIENT_SECRET"],
90+
),
91+
thirdpartyemailpassword.ProviderClientConfig(
92+
client_id=os.environ["GITHUB_CLIENT_ID_MOBILE"],
93+
client_secret=os.environ["GITHUB_CLIENT_SECRET_MOBILE"],
94+
),
95+
],
96+
)
9997
),
100-
Apple(
101-
client_id=os.environ.get("APPLE_CLIENT_ID_MOBILE"), # type: ignore
102-
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
103-
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
104-
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
98+
thirdpartyemailpassword.ProviderInput(
99+
config=thirdpartyemailpassword.ProviderConfig(
100+
third_party_id="apple",
101+
clients=[
102+
thirdpartyemailpassword.ProviderClientConfig(
103+
client_id=os.environ["APPLE_CLIENT_ID"],
104+
additional_config={
105+
"keyId": os.environ["APPLE_KEY_ID"],
106+
"teamId": os.environ["APPLE_TEAM_ID"],
107+
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
108+
},
109+
),
110+
thirdpartyemailpassword.ProviderClientConfig(
111+
client_id=os.environ["APPLE_CLIENT_ID_MOBILE"],
112+
additional_config={
113+
"keyId": os.environ["APPLE_KEY_ID"],
114+
"teamId": os.environ["APPLE_TEAM_ID"],
115+
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
116+
},
117+
),
118+
],
119+
)
105120
),
106-
GoogleWorkspaces(
107-
is_default=True,
108-
client_id=os.environ.get("GOOGLE_WORKSPACES_CLIENT_ID"), # type: ignore
109-
client_secret=os.environ.get("GOOGLE_WORKSPACES_CLIENT_SECRET"), # type: ignore
121+
thirdpartyemailpassword.ProviderInput(
122+
config=thirdpartyemailpassword.ProviderConfig(
123+
third_party_id="googleworkspaces",
124+
clients=[
125+
thirdpartyemailpassword.ProviderClientConfig(
126+
client_id=os.environ["GOOGLE_WORKSPACES_CLIENT_ID"],
127+
client_secret=os.environ[
128+
"GOOGLE_WORKSPACES_CLIENT_SECRET"
129+
],
130+
),
131+
],
132+
)
110133
),
111-
Discord(
112-
is_default=True,
113-
client_id=os.environ.get("DISCORD_CLIENT_ID"), # type: ignore
114-
client_secret=os.environ.get("DISCORD_CLIENT_SECRET"), # type: ignore
134+
thirdpartyemailpassword.ProviderInput(
135+
config=thirdpartyemailpassword.ProviderConfig(
136+
third_party_id="discord",
137+
clients=[
138+
thirdpartyemailpassword.ProviderClientConfig(
139+
client_id=os.environ["DISCORD_CLIENT_ID"],
140+
client_secret=os.environ["DISCORD_CLIENT_SECRET"],
141+
),
142+
],
143+
)
115144
),
116145
]
117146
),

examples/with-fastapi/with-thirdpartyemailpassword/main.py

Lines changed: 73 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@
2222
)
2323
from supertokens_python.recipe.session import SessionContainer
2424
from supertokens_python.recipe.session.framework.fastapi import verify_session
25-
from supertokens_python.recipe.thirdpartyemailpassword import (
26-
Apple,
27-
Discord,
28-
Github,
29-
Google,
30-
GoogleWorkspaces,
31-
)
25+
3226

3327
load_dotenv()
3428

@@ -62,46 +56,82 @@ def get_website_domain():
6256
emailverification.init("REQUIRED"),
6357
thirdpartyemailpassword.init(
6458
providers=[
65-
Google(
66-
is_default=True,
67-
client_id=os.environ.get("GOOGLE_CLIENT_ID"), # type: ignore
68-
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
69-
),
70-
Google(
71-
client_id=os.environ.get("GOOGLE_CLIENT_ID_MOBILE"), # type: ignore
72-
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore
73-
),
74-
Github(
75-
is_default=True,
76-
client_id=os.environ.get("GITHUB_CLIENT_ID"), # type: ignore
77-
client_secret=os.environ.get("GITHUB_CLIENT_SECRET"), # type: ignore
78-
),
79-
Github(
80-
client_id=os.environ.get("GITHUB_CLIENT_ID_MOBILE"), # type: ignore
81-
client_secret=os.environ.get("GITHUB_CLIENT_SECRET_MOBILE"), # type: ignore
59+
thirdpartyemailpassword.ProviderInput(
60+
config=thirdpartyemailpassword.ProviderConfig(
61+
third_party_id="google",
62+
clients=[
63+
thirdpartyemailpassword.ProviderClientConfig(
64+
client_id=os.environ["GOOGLE_CLIENT_ID"],
65+
client_secret=os.environ["GOOGLE_CLIENT_SECRET"],
66+
),
67+
thirdpartyemailpassword.ProviderClientConfig(
68+
client_id=os.environ["GOOGLE_CLIENT_ID_MOBILE"],
69+
client_secret=os.environ["GOOGLE_CLIENT_SECRET_MOBILE"],
70+
),
71+
],
72+
),
8273
),
83-
Apple(
84-
is_default=True,
85-
client_id=os.environ.get("APPLE_CLIENT_ID"), # type: ignore
86-
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
87-
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
88-
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
74+
thirdpartyemailpassword.ProviderInput(
75+
config=thirdpartyemailpassword.ProviderConfig(
76+
third_party_id="github",
77+
clients=[
78+
thirdpartyemailpassword.ProviderClientConfig(
79+
client_id=os.environ["GITHUB_CLIENT_ID"],
80+
client_secret=os.environ["GITHUB_CLIENT_SECRET"],
81+
),
82+
thirdpartyemailpassword.ProviderClientConfig(
83+
client_id=os.environ["GITHUB_CLIENT_ID_MOBILE"],
84+
client_secret=os.environ["GITHUB_CLIENT_SECRET_MOBILE"],
85+
),
86+
],
87+
)
8988
),
90-
Apple(
91-
client_id=os.environ.get("APPLE_CLIENT_ID_MOBILE"), # type: ignore
92-
client_key_id=os.environ.get("APPLE_KEY_ID"), # type: ignore
93-
client_team_id=os.environ.get("APPLE_TEAM_ID"), # type: ignore
94-
client_private_key=os.environ.get("APPLE_PRIVATE_KEY"), # type: ignore
89+
thirdpartyemailpassword.ProviderInput(
90+
config=thirdpartyemailpassword.ProviderConfig(
91+
third_party_id="apple",
92+
clients=[
93+
thirdpartyemailpassword.ProviderClientConfig(
94+
client_id=os.environ["APPLE_CLIENT_ID"],
95+
additional_config={
96+
"keyId": os.environ["APPLE_KEY_ID"],
97+
"teamId": os.environ["APPLE_TEAM_ID"],
98+
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
99+
},
100+
),
101+
thirdpartyemailpassword.ProviderClientConfig(
102+
client_id=os.environ["APPLE_CLIENT_ID_MOBILE"],
103+
additional_config={
104+
"keyId": os.environ["APPLE_KEY_ID"],
105+
"teamId": os.environ["APPLE_TEAM_ID"],
106+
"privateKey": os.environ["APPLE_PRIVATE_KEY"],
107+
},
108+
),
109+
],
110+
)
95111
),
96-
GoogleWorkspaces(
97-
is_default=True,
98-
client_id=os.environ.get("GOOGLE_WORKSPACES_CLIENT_ID"), # type: ignore
99-
client_secret=os.environ.get("GOOGLE_WORKSPACES_CLIENT_SECRET"), # type: ignore
112+
thirdpartyemailpassword.ProviderInput(
113+
config=thirdpartyemailpassword.ProviderConfig(
114+
third_party_id="googleworkspaces",
115+
clients=[
116+
thirdpartyemailpassword.ProviderClientConfig(
117+
client_id=os.environ["GOOGLE_WORKSPACES_CLIENT_ID"],
118+
client_secret=os.environ[
119+
"GOOGLE_WORKSPACES_CLIENT_SECRET"
120+
],
121+
),
122+
],
123+
)
100124
),
101-
Discord(
102-
is_default=True,
103-
client_id=os.environ.get("DISCORD_CLIENT_ID"), # type: ignore
104-
client_secret=os.environ.get("DISCORD_CLIENT_SECRET"), # type: ignore
125+
thirdpartyemailpassword.ProviderInput(
126+
config=thirdpartyemailpassword.ProviderConfig(
127+
third_party_id="discord",
128+
clients=[
129+
thirdpartyemailpassword.ProviderClientConfig(
130+
client_id=os.environ["DISCORD_CLIENT_ID"],
131+
client_secret=os.environ["DISCORD_CLIENT_SECRET"],
132+
),
133+
],
134+
)
105135
),
106136
]
107137
),

0 commit comments

Comments
 (0)