|
22 | 22 | )
|
23 | 23 | from supertokens_python.recipe.session import SessionContainer
|
24 | 24 | 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 | + |
32 | 26 |
|
33 | 27 | load_dotenv()
|
34 | 28 |
|
@@ -62,46 +56,82 @@ def get_website_domain():
|
62 | 56 | emailverification.init("REQUIRED"),
|
63 | 57 | thirdpartyemailpassword.init(
|
64 | 58 | 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 | + ), |
82 | 73 | ),
|
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 | + ) |
89 | 88 | ),
|
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 | + ) |
95 | 111 | ),
|
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 | + ) |
100 | 124 | ),
|
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 | + ) |
105 | 135 | ),
|
106 | 136 | ]
|
107 | 137 | ),
|
|
0 commit comments