From df22f253dc0ed0f499bf0601e0590e410073b950 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Mon, 18 Mar 2024 20:57:50 +0530 Subject: [PATCH] fix: session functions --- CHANGELOG.md | 4 ++++ recipe/session/sessionFunctions.go | 10 +++++++++- supertokens/constants.go | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0493c73e..d8f020d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [0.17.6] - 2024-03-18 + +- Fixes the passing of `tenantId` in `getAllSessionHandlesForUser` and `revokeAllSessionsForUser` based on `fetchAcrossAllTenants` and `revokeAcrossAllTenants` inputs respectively. + ## [0.17.5] - 2024-03-14 - Adds a type uint64 to the `accessTokenCookiesExpiryDurationMillis` local variable in `recipe/session/utils.go`. It also removes the redundant `uint64` type forcing needed because of the untyped variable. diff --git a/recipe/session/sessionFunctions.go b/recipe/session/sessionFunctions.go index 702c2b76..43b0f858 100644 --- a/recipe/session/sessionFunctions.go +++ b/recipe/session/sessionFunctions.go @@ -276,6 +276,10 @@ func revokeAllSessionsForUserHelper(querier supertokens.Querier, userID string, } if revokeAcrossAllTenants != nil { requestBody["revokeAcrossAllTenants"] = *revokeAcrossAllTenants + + if *revokeAcrossAllTenants { + tenantId = "" // so that we don't pass the tenantId in the url + } } response, err := querier.SendPostRequest(tenantId+"/recipe/session/remove", requestBody, userContext) if err != nil { @@ -299,8 +303,12 @@ func getAllSessionHandlesForUserHelper(querier supertokens.Querier, userID strin } if fetchAcrossAllTenants != nil { queryParams["fetchAcrossAllTenants"] = strings.ToLower(fmt.Sprintf("%v", *fetchAcrossAllTenants)) + + if *fetchAcrossAllTenants { + tenantId = "" // so that we don't pass the tenantId in the url + } } - response, err := querier.SendGetRequest("/recipe/session/user", queryParams, userContext) + response, err := querier.SendGetRequest(tenantId+"/recipe/session/user", queryParams, userContext) if err != nil { return nil, err } diff --git a/supertokens/constants.go b/supertokens/constants.go index 200d0d49..edcb4303 100644 --- a/supertokens/constants.go +++ b/supertokens/constants.go @@ -21,7 +21,7 @@ const ( ) // VERSION current version of the lib -const VERSION = "0.17.5" +const VERSION = "0.17.6" var ( cdiSupported = []string{"3.0"}