Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony3 No route found for "GET /logout"

I cant seam to get the logout working on symfony3. I've been following the symfony documentation SecurityBundle Configuration and as far as I can tell my config file seams to be by there specification yet when i go to /logout i get the following response:

No route found for "GET /logout" (from "http://localhost:8000/admin").

Any ideas on what my problem could be?

My security.yml:

security:
encoders:
    AppBundle\Entity\User:
        algorithm: bcrypt
    Symfony\Component\Security\Core\User\User: plaintext
providers:
    chain_provider:
            chain:
                providers: [in_memory, database_provider]
    in_memory:
        memory:
          users:
            test:
                password: test
                roles: 'ROLE_ADMIN'
            admin:
                password: admin
                roles: 'ROLE_ADMIN'
    database_provider:
        entity:
            class: AppBundle:User
            property: email
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        anonymous: true
        logout: true
        form_login:
            check_path: /login
            login_path: /login
            default_target_path: /login
            always_use_default_target_path: true
        logout:
            path:   /logout
            target: /login
like image 687
Anestori Avatar asked Apr 02 '16 19:04

Anestori


1 Answers

The awsver is so simple I almost removed the question, but I guess having a well configured security.yml can be a good example for other who are having problems.

just add the route to route.yml

# app/config/routing.yml
logout:
   path: /logout
like image 120
Anestori Avatar answered Sep 24 '22 00:09

Anestori