title: Symfony 4: Cannot access admin roles. Access Denied
body: <p>I'm learning Symfony 4 and try to make follow Symfony 4 Documentation to create an app. </p>
  
  <p>I do follow this <a href="https://symfony.com/doc/current/security.html" rel="nofollow noreferrer">article</a> to make admin roles.</p>
  
  <p>But when I access path <code>/admin</code>, it's always <code>"Access Denied."</code></p>
  
  <p>I read many article in Symfony Documentation page and StackOverflow but can not found the way to solve it. Here is my setting</p>
  
  <pre><code>//config/packges/security.yaml
  
  security:
  
      encoders:
          App\Entity\User:
              algorithm: bcrypt
      providers:
          our_db_provider:
              entity:
                  class: App\Entity\User
          in_memory:
              memory:
                  users:
                      admin:
                          password: admin123
                          roles: 'ROLE_ADMIN'
      firewalls:
          dev:
              pattern: ^/(_(profiler|wdt)|css|images|js)/
              security: false
          main:
              pattern:    ^/
              http_basic: ~
              provider: our_db_provider
              form_login:
                login_path: login
                check_path: login
                default_target_path: index
                always_use_default_target_path: true
  
              logout:
                path:   /logout
                target: /index
  
      access_control:
          - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
          - { path: ^/admin, roles: ROLE_ADMIN }
  </code></pre>
  
  <p>And here is the Symfony Debug log:</p>
  
  <blockquote>
    <p>Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AccessDeniedException: "Access Denied." at C:\xampp\htdocs\aimer-mvc\vendor\symfony\security\Http\Firewall\AccessListener.php line 68</p>
  </blockquote>
  
  <p>Please help me. Thank you so much!</p>