Skip to content

Commit dd2b009

Browse files
committed
fix: servers
1 parent eecf3ad commit dd2b009

File tree

7 files changed

+29
-12
lines changed

7 files changed

+29
-12
lines changed

supertokens_python/recipe/accountlinking/recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def init(
147147
) -> Callable[..., AccountLinkingRecipe]:
148148
from supertokens_python.plugins import OverrideMap, apply_plugins
149149

150-
cofnfig = AccountLinkingConfig(
150+
config = AccountLinkingConfig(
151151
on_account_linked=on_account_linked,
152152
should_do_automatic_account_linking=should_do_automatic_account_linking,
153153
override=override,
@@ -160,7 +160,7 @@ def func(app_info: AppInfo, plugins: List[OverrideMap]):
160160
app_info=app_info,
161161
config=apply_plugins(
162162
recipe_id=AccountLinkingRecipe.recipe_id,
163-
config=cofnfig,
163+
config=config,
164164
plugins=plugins,
165165
),
166166
)

tests/frontendIntegration/django2x/polls/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from supertokens_python.normalised_url_path import NormalisedURLPath
3737
from supertokens_python.querier import Querier
3838
from supertokens_python.recipe import session
39+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
3940
from supertokens_python.recipe.jwt.recipe import JWTRecipe
4041
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
4142
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -607,6 +608,7 @@ def reinitialize(request: HttpRequest):
607608
OpenIdRecipe.reset()
608609
OAuth2ProviderRecipe.reset()
609610
JWTRecipe.reset()
611+
AccountLinkingRecipe.reset()
610612
config(
611613
data["coreUrl"],
612614
last_set_enable_anti_csrf,
@@ -627,6 +629,7 @@ def setup_st(request: HttpRequest):
627629
OpenIdRecipe.reset()
628630
OAuth2ProviderRecipe.reset()
629631
JWTRecipe.reset()
632+
AccountLinkingRecipe.reset()
630633
config(
631634
core_url=data["coreUrl"],
632635
enable_anti_csrf=data.get("enableAntiCsrf"),

tests/frontendIntegration/django3x/polls/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from supertokens_python.normalised_url_path import NormalisedURLPath
3535
from supertokens_python.querier import Querier
3636
from supertokens_python.recipe import session
37+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
3738
from supertokens_python.recipe.jwt.recipe import JWTRecipe
3839
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
3940
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -608,6 +609,7 @@ async def reinitialize(request: HttpRequest):
608609
OpenIdRecipe.reset()
609610
OAuth2ProviderRecipe.reset()
610611
JWTRecipe.reset()
612+
AccountLinkingRecipe.reset()
611613
config(
612614
data["coreUrl"],
613615
last_set_enable_anti_csrf,
@@ -628,6 +630,7 @@ async def setup_st(request: HttpRequest):
628630
OpenIdRecipe.reset()
629631
OAuth2ProviderRecipe.reset()
630632
JWTRecipe.reset()
633+
AccountLinkingRecipe.reset()
631634
config(
632635
core_url=data["coreUrl"],
633636
enable_anti_csrf=data.get("enableAntiCsrf"),

tests/frontendIntegration/drf_async/polls/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from supertokens_python.normalised_url_path import NormalisedURLPath
4141
from supertokens_python.querier import Querier
4242
from supertokens_python.recipe import session
43+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
4344
from supertokens_python.recipe.jwt.recipe import JWTRecipe
4445
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
4546
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -671,6 +672,7 @@ async def reinitialize(request: Request): # type: ignore
671672
OpenIdRecipe.reset()
672673
OAuth2ProviderRecipe.reset()
673674
JWTRecipe.reset()
675+
AccountLinkingRecipe.reset()
674676
config(
675677
data["coreUrl"], # type: ignore
676678
last_set_enable_anti_csrf,
@@ -693,6 +695,7 @@ async def setup_st(request: HttpRequest): # type: ignore
693695
OpenIdRecipe.reset()
694696
OAuth2ProviderRecipe.reset()
695697
JWTRecipe.reset()
698+
AccountLinkingRecipe.reset()
696699
config(
697700
core_url=data["coreUrl"],
698701
enable_anti_csrf=data.get("enableAntiCsrf"),

tests/frontendIntegration/drf_sync/polls/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from supertokens_python.normalised_url_path import NormalisedURLPath
4040
from supertokens_python.querier import Querier
4141
from supertokens_python.recipe import session
42+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
4243
from supertokens_python.recipe.jwt.recipe import JWTRecipe
4344
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
4445
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -673,6 +674,7 @@ def reinitialize(request: Request): # type: ignore
673674
OpenIdRecipe.reset()
674675
OAuth2ProviderRecipe.reset()
675676
JWTRecipe.reset()
677+
AccountLinkingRecipe.reset()
676678
config(
677679
data["coreUrl"], # type: ignore
678680
last_set_enable_anti_csrf,
@@ -695,6 +697,7 @@ def setup_st(request: HttpRequest): # type: ignore
695697
OpenIdRecipe.reset()
696698
OAuth2ProviderRecipe.reset()
697699
JWTRecipe.reset()
700+
AccountLinkingRecipe.reset()
698701
config(
699702
core_url=data["coreUrl"],
700703
enable_anti_csrf=data.get("enableAntiCsrf"),

tests/frontendIntegration/fastapi-server/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from supertokens_python.normalised_url_path import NormalisedURLPath
3939
from supertokens_python.querier import Querier
4040
from supertokens_python.recipe import session
41+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
4142
from supertokens_python.recipe.jwt.recipe import JWTRecipe
4243
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
4344
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -657,6 +658,7 @@ async def reinitialize(request: Request):
657658
OpenIdRecipe.reset()
658659
OAuth2ProviderRecipe.reset()
659660
JWTRecipe.reset()
661+
AccountLinkingRecipe.reset()
660662
config(
661663
json["coreUrl"],
662664
last_set_enable_anti_csrf,
@@ -678,6 +680,7 @@ async def setup_st(request: Request):
678680
OpenIdRecipe.reset()
679681
OAuth2ProviderRecipe.reset()
680682
JWTRecipe.reset()
683+
AccountLinkingRecipe.reset()
681684
config(
682685
core_url=json["coreUrl"],
683686
enable_anti_csrf=json.get("enableAntiCsrf"),

tests/frontendIntegration/flask-server/app.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from supertokens_python.normalised_url_path import NormalisedURLPath
3939
from supertokens_python.querier import Querier
4040
from supertokens_python.recipe import session
41+
from supertokens_python.recipe.accountlinking.recipe import AccountLinkingRecipe
4142
from supertokens_python.recipe.jwt.recipe import JWTRecipe
4243
from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe
4344
from supertokens_python.recipe.oauth2provider.recipe import OAuth2ProviderRecipe
@@ -282,16 +283,6 @@ def config(
282283
)
283284

284285

285-
core_host = os.environ.get("SUPERTOKENS_CORE_HOST", "localhost")
286-
core_port = os.environ.get("SUPERTOKENS_CORE_PORT", "3567")
287-
config(
288-
core_url=f"http://{core_host}:{core_port}",
289-
enable_anti_csrf=True,
290-
enable_jwt=False,
291-
jwt_property_name=None,
292-
)
293-
294-
295286
@app.route("/index.html", methods=["GET"]) # type: ignore
296287
def send_file():
297288
return render_template("index.html")
@@ -674,6 +665,7 @@ def reinitialize():
674665
OpenIdRecipe.reset()
675666
OAuth2ProviderRecipe.reset()
676667
JWTRecipe.reset()
668+
AccountLinkingRecipe.reset()
677669
config(
678670
json["coreUrl"],
679671
last_set_enable_anti_csrf, # type: ignore
@@ -695,6 +687,7 @@ async def setup_st(): # type: ignore
695687
OpenIdRecipe.reset()
696688
OAuth2ProviderRecipe.reset()
697689
JWTRecipe.reset()
690+
AccountLinkingRecipe.reset()
698691
config(
699692
core_url=json["coreUrl"],
700693
enable_anti_csrf=json.get("enableAntiCsrf"), # type: ignore
@@ -733,5 +726,14 @@ def handle_exception(e): # type: ignore
733726
return Response(str(e), status=500) # type: ignore
734727

735728

729+
core_host = os.environ.get("SUPERTOKENS_CORE_HOST", "localhost")
730+
core_port = os.environ.get("SUPERTOKENS_CORE_PORT", "3567")
731+
config(
732+
core_url=f"http://{core_host}:{core_port}",
733+
enable_anti_csrf=True,
734+
enable_jwt=False,
735+
jwt_property_name=None,
736+
)
737+
736738
if __name__ == "__main__":
737739
app.run(host="0.0.0.0", port=int(get_app_port()), threaded=True)

0 commit comments

Comments
 (0)