symfony Full authentication is required to access this resource

14,175

I think under your secured area firewall you need to specify an authentication type such as http_basic: ~

Share:
14,175

Related videos on Youtube

Redman
Author by

Redman

Updated on June 04, 2022

Comments

  • Redman
    Redman almost 2 years

    I can not access the admin page from my symfony project.

    If I visit XXX.XXX.XXX.XXX/admin I get:

    Full authentication is required to access this resource
    

    However going to XXX.XXX.XXX.XXX/security/login gives me the login page.

    What am I doing wrong?

    security:
    
    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        in_memory:
            memory:
              users:
                  admin:
                      password: XXX
                      roles: 'ROLE_ADMIN'
    
    encoders:
        Symfony\Component\Security\Core\User\User:
          algorithm: bcrypt
    
    
    
    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        secured_area:
            pattern: ^/admin
            anonymous: ~
        main:
            anonymous: ~
            # activate different ways to authenticate
    
            # http_basic: ~
            # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
    
            # form_login: ~
            # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
            form_login:
                login_path: security_login
                check_path: security_login
                csrf_token_generator: security.csrf.token_manager
                default_target_path: userRedirectAction
            logout:
                path: /logout
                target: /blog
    
    access_control:
     # require ROLE_ADMIN for /admin*
      - { path: ^/admin, roles: ROLE_ADMIN }