diff --git a/services/src/main/java/org/keycloak/services/resources/TokenService.java b/services/src/main/java/org/keycloak/services/resources/TokenService.java index 4c6c431c90..d964906864 100755 --- a/services/src/main/java/org/keycloak/services/resources/TokenService.java +++ b/services/src/main/java/org/keycloak/services/resources/TokenService.java @@ -964,9 +964,11 @@ public class TokenService { LoginFormsProvider forms = Flows.forms(session, realm, client, uriInfo); String rememberMeUsername = null; - Cookie rememberMeCookie = headers.getCookies().get(AuthenticationManager.KEYCLOAK_REMEMBER_ME); - if (rememberMeCookie != null && !"".equals(rememberMeCookie.getValue())) { - rememberMeUsername = rememberMeCookie.getValue(); + if (realm.isRememberMe()) { + Cookie rememberMeCookie = headers.getCookies().get(AuthenticationManager.KEYCLOAK_REMEMBER_ME); + if (rememberMeCookie != null && !"".equals(rememberMeCookie.getValue())) { + rememberMeUsername = rememberMeCookie.getValue(); + } } if (loginHint != null || rememberMeUsername != null) {