Skip to content

fix: session functions #478

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 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]


## [0.18.9] - 2024-03-14

- Updates version for CICD testing
- Fixes session recipe to not pass tenant id when `revoke_across_all_tenants` or `fetch_across_all_tenants` is set to `True`
- Updated fake email generation

## [0.18.8] - 2024-02-29

Expand Down
34 changes: 24 additions & 10 deletions supertokens_python/recipe/session/session_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,18 @@ async def revoke_all_sessions_for_user(
if tenant_id is None:
tenant_id = DEFAULT_TENANT_ID

response = await recipe_implementation.querier.send_post_request(
NormalisedURLPath(f"{tenant_id}/recipe/session/remove"),
{"userId": user_id, "revokeAcrossAllTenants": revoke_across_all_tenants},
user_context=user_context,
)
if revoke_across_all_tenants:
response = await recipe_implementation.querier.send_post_request(
NormalisedURLPath(f"/recipe/session/remove"),
{"userId": user_id, "revokeAcrossAllTenants": revoke_across_all_tenants},
user_context=user_context,
)
else:
response = await recipe_implementation.querier.send_post_request(
NormalisedURLPath(f"{tenant_id}/recipe/session/remove"),
{"userId": user_id, "revokeAcrossAllTenants": revoke_across_all_tenants},
user_context=user_context,
)
return response["sessionHandlesRevoked"]


Expand All @@ -422,11 +429,18 @@ async def get_all_session_handles_for_user(
if tenant_id is None:
tenant_id = DEFAULT_TENANT_ID

response = await recipe_implementation.querier.send_get_request(
NormalisedURLPath(f"{tenant_id}/recipe/session/user"),
{"userId": user_id, "fetchAcrossAllTenants": fetch_across_all_tenants},
user_context=user_context,
)
if fetch_across_all_tenants:
response = await recipe_implementation.querier.send_get_request(
NormalisedURLPath(f"/recipe/session/user"),
{"userId": user_id, "fetchAcrossAllTenants": fetch_across_all_tenants},
user_context=user_context,
)
else:
response = await recipe_implementation.querier.send_get_request(
NormalisedURLPath(f"{tenant_id}/recipe/session/user"),
{"userId": user_id, "fetchAcrossAllTenants": fetch_across_all_tenants},
user_context=user_context,
)
return response["sessionHandles"]


Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/recipe/thirdparty/providers/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def default_generate_fake_email(
_tenant_id: str, third_party_user_id: str, _: Dict[str, Any]
) -> str:
return (
f"{third_party_user_id}@{input_config.third_party_id}.fakeemail.com"
f"{third_party_user_id}.{input_config.third_party_id}@stfakeemail.supertokens.com"
)

input_config.generate_fake_email = default_generate_fake_email
Expand Down