Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Cannot logout with Symfony 4

$
0
0

I cannot logout a user.

I ported custom user management logic over to a Symfony 4 project. It uses recipes for security and guard.

Here is the logout config in my main firewall:

    logout:
        path: /logout
        target: /

Result: - User goes to /logout - User is redirected to / - is_granted("IS_AUTHENTICATED_REMEMBERED") continues to return true in my template (false is expected)

Other Considerations: - The firewall entry is getting triggered because I get errors if I remove it - I have tried adding additional parameters to logout to destroy the session and cookies, however that made no difference - Logging in works fine

Any idea on how to troubleshoot this?

:: edit - added security.yaml as requested ::

security:
    encoders:
        App\Entity\User: bcrypt
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN
    providers:
        app_users:
            entity: { class: App\Entity\User, property: email }
        app_oauth:
            id: app.oauth_user_provider
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            provider: app_users
            anonymous: ~
            oauth:
                resource_owners:
                    google: "/login/check-google"
                default_target_path: /
                login_path: /
                failure_path: /login
                oauth_user_provider:
                    service: app.oauth_user_provider
            remember_me:
                secret: "%env(APP_SECRET)%"
                lifetime: 2592000
                path:  /
            guard:
                authenticators:
                    - App\Security\LoginFormAuthenticator
                entry_point: App\Security\LoginFormAuthenticator
            logout:
                path: /logout
                target: /
            switch_user: ~

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>