title: Symfony 4 Remember me not working without username
body: <p>How can we configure Symfony 4 Remember me functionality to use email instead of username (as set by default) when creating the cookie and storing it in the browser?</p>
  
  <p>My issue is that by using email to authenticate in S4, the cookie is created with the username instead of the email in its hash, stored in the browser but when S4 check my cookie to see if <code>IS_AUTHENTICATED_REMEMBERED</code> is true, it checks it against the username stored in the DB which doesn’t make sens. It should check it against email. So my remember me functionality doesn’t work.
  If I use the username to login, then it works, but that’s not what I want, I’d like my users to log in with their email address.</p>
  
  <p>I’ve configurered the login to work with email instead of the default username behavior, but I can’t have remember me working that way.</p>
  
  <p>I tried the following in my <code>security.yaml</code></p>
  
  <pre><code>security:
      encoders:
          App\Entity\User:
              algorithm: bcrypt
      providers:
          user_provider:
              entity:
                  class: App\Entity\User
                  property: email
          in_memory: { memory: ~ }
          our_db_provider:
              entity:
                  class: App\Entity\User
                  property: email
      firewalls:
          dev:
              pattern: ^/(_(profiler|wdt)|css|images|js)/
              security: false
          main:
              pattern:    ^/
              http_basic: ~
              provider: our_db_provider
              anonymous: ~
              form_login:
                  login_path: login
                  check_path: login
                  default_target_path: dashboard
                  username_parameter: email
                  password_parameter: password
                  remember_me: true
              remember_me:
                  secret:   '%kernel.secret%'
                  lifetime: 31536000 # 1 week in seconds
                  path: /
                  domain: ~
                  secure:   true
                  name:     REMEMBERME
                  remember_me_parameter: remember_me
                  always_remember_me: true
              logout:
                  path:  /logout
                  target: /
  </code></pre>
  
  <p>but this doesn’t let you parameter what field remember is using to generate the hash stored in the cookie.</p>
  
  <p>If you’ve managed to set up your login / authentication &amp; remember me working with a field different than username, please share :)</p>
  
  <p>UPDATE: I tried Ahmed answer with the following lines on services but it’s not working:</p>
  
  <pre><code>App\Security\TokenBasedRememberMeServices:
        decorates: Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices
  </code></pre>
  
  <p>it says <code>You have requested a non-existent service "Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices”.</code></p>