diff --git a/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java b/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java index 3eb502dc5..739d182bd 100644 --- a/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java +++ b/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java @@ -32,6 +32,7 @@ import io.supertokens.pluginInterface.passwordless.exception.DuplicatePhoneNumberException; import io.supertokens.pluginInterface.thirdparty.exception.DuplicateThirdPartyUserException; import io.supertokens.useridmapping.UserIdType; +import io.supertokens.utils.SemVer; import io.supertokens.webserver.InputParser; import io.supertokens.webserver.WebserverAPI; import jakarta.servlet.ServletException; @@ -56,7 +57,13 @@ public String getPath() { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { JsonObject input = InputParser.parseJsonObjectOrThrowError(req); - String userId = InputParser.parseStringOrThrowError(input, "userId", false); + String userId; + + if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) { + userId = InputParser.parseStringOrThrowError(input, "userId", false); + } else { + userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false); + } // normalize userId userId = userId.trim(); diff --git a/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java b/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java index 9553efa91..a37c3a595 100644 --- a/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java +++ b/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java @@ -50,7 +50,13 @@ public String getPath() { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { JsonObject input = InputParser.parseJsonObjectOrThrowError(req); - String userId = InputParser.parseStringOrThrowError(input, "userId", false); + String userId; + + if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) { + userId = InputParser.parseStringOrThrowError(input, "userId", false); + } else { + userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false); + } // normalize userId userId = userId.trim();