6

Is there a way for debugging "Access Denied" errors in Drupal 8? I'm having some routing/permission issues, and I would like to be able to debug why i'm getting "Access Denied".

  • You can check watch_dog table. Please specifiy latest watchdog table information here so we can identify exact problem. – parth.k May 31 '16 at 8:26
  • It's not the exact problem i'm trying to find a solution for. I mostly find it myself by adjusting permissions or configuration, but it often takes some time because there's no clear indication what permission causes the 403. And I checked watchdog, only thing I can see is "access_denied" "route", "timestamp", "user", which I already knew :) – pjcarly May 31 '16 at 8:30
  • Have you tried to clear the cache table using drush ? drush cache-clear please try this command for drupal 8. – parth.k May 31 '16 at 8:47
9

Install the devel module and then Web Profile module which is bundled with it. You will then see the Symfony web profiler bar below the browser screen. Click on a Request gear icon, and it will show you the route and the controller class. You can start there.

enter image description here

You can also search your code base for that route name and see, if there are additional cases when it is handled.

  • This is usefull if the controller is letting you deny access, but since also elements can throw a denied this is not solely the answer for debugging an access denied. Webprofiler is a cool tool though. – absoludo Apr 19 '17 at 10:01
  • I can't see the toolbar, but I do see it in Admin. Is this because I'm anonymous in the page I want to debug? – JorgeeFG Oct 18 '18 at 0:04
  • @JorgeeFG The webprofiler for Drupal has a setting to show the toolbar even for anonymous users, if I remember correctly. You just need to check that setting. – Alexei Rayu Oct 18 '18 at 7:36
  • @AlexeiRayu I didn't find it in the module's settings :( – JorgeeFG Oct 18 '18 at 16:10
  • 1
    @JorgeeFG Looked it up - there is a permission "View webprofiler toolbar" in the permissions section that you can assign to anonymous users. – Alexei Rayu Oct 18 '18 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.