Symfony + FOSUserBundle can't login
<p>I'm using Symfony 3.1 with FOSUserBundle.</p>

<p>I read the docs and integrated FOS in Symfony, here all right, the registration seems to work well and persists the data to the DB, BUT, if I try to login I get redirected again to the login page as an anonymous user.</p>

<p>I checked the Symfony Profiler, and I can see that when it's called the path /login_check (in the profiler) the user result as authenticated, but then after the /login_check phase, when I get redirected, the user is as anonymous...</p>

<p>--</p>

<p>/login_check from profiler:</p>

<p>Property    Value</p>

<p>Roles   [ROLE_USER]</p>

<p>Inherited Roles none</p>

<p>Token class Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken</p>

<p>--</p>

<p>The sessions seems to exist (dump(app.session)) is not empty, but no stores data of user.</p>

<p>That's my security.yml:</p>

<p>security:</p>

<pre><code>encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            login_path: /login
            check_path: /login_check
            default_target_path: /redirLogIn
#                csrf_token_generator: security.csrf.token_manager

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
#        - { path: ^/admin.*, role: ROLE_ADMIN}
#        - { path: ^/, role: ROLE_USER}
</code></pre>

<p>(I disabled the csrf token due to problems on registration)</p>

<p>(This is an intranet, there is no "homepage", as you open the site you are requested to login) </p>

<p>Why this?</p>

<p>Thanks</p>