diff --git a/src/main/java/io/supertokens/oauth/Transformations.java b/src/main/java/io/supertokens/oauth/Transformations.java index 4a0c4afc9..150763d21 100644 --- a/src/main/java/io/supertokens/oauth/Transformations.java +++ b/src/main/java/io/supertokens/oauth/Transformations.java @@ -82,8 +82,7 @@ private static String transformQueryParamsInURLFromHydra(String redirectTo) { updatedQuery.append(param).append("&"); } } - redirectTo = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + url.getPath() + "?" - + updatedQuery.toString().trim(); + redirectTo = redirectTo.replace("?" + query, "?" + updatedQuery.toString().trim()); } } catch (MalformedURLException e) { throw new IllegalStateException(e);