Skip to content

Commit 0b0dafd

Browse files
authored
test: setting session cookies (#593)
- feat: adds support for token transfer method
1 parent 756465e commit 0b0dafd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/test-server/app.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import os
44
import traceback
5-
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar
5+
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, TypeVar, Union
66

77
import override_logging
88
from accountlinking import add_accountlinking_routes # pylint: disable=import-error
@@ -56,6 +56,7 @@
5656
from supertokens_python.recipe.session import InputErrorHandlers, SessionContainer
5757
from supertokens_python.recipe.session.framework.flask import verify_session
5858
from supertokens_python.recipe.session.recipe import SessionRecipe
59+
from supertokens_python.recipe.session.utils import TokenTransferMethod
5960
from supertokens_python.recipe.thirdparty.provider import UserFields, UserInfoMap
6061
from supertokens_python.recipe.thirdparty.recipe import ThirdPartyRecipe
6162
from supertokens_python.recipe.totp.recipe import TOTPRecipe
@@ -305,6 +306,13 @@ async def custom_unauthorised_callback(
305306
)
306307
return response
307308

309+
def get_token_transfer_method(
310+
_: BaseRequest,
311+
__: bool,
312+
___: Dict[str, Any],
313+
) -> Union[TokenTransferMethod, Literal["any"]]:
314+
return recipe_config_json.get("getTokenTransferMethod", "any")
315+
308316
recipe_config_json = json.loads(recipe_config.get("config", "{}"))
309317
recipe_list.append(
310318
session.init(
@@ -325,6 +333,7 @@ async def custom_unauthorised_callback(
325333
use_dynamic_access_token_signing_key=recipe_config_json.get(
326334
"useDynamicAccessTokenSigningKey"
327335
),
336+
get_token_transfer_method=get_token_transfer_method,
328337
override=session.InputOverrideConfig(
329338
apis=override_builder_with_logging(
330339
"Session.override.apis",

0 commit comments

Comments
 (0)