Working with Magento 2, you can come across multiple errors or notices that keep destructive or interrupting the management process. One of the most common Magento errors is Access Denied HTTP error 403 which appears when you work with Magento 2 admin. 

Magento Access Denied

While many of you face this issue, few really know what it is connected with or how to solve this. So, in this guide, we'll provide a really simple and quick fix for the "Access denied" error to enable anyone with or without technical skills to deal with it.

However, let's define what is Magento "Access denied" error is in the first place.

What is Magento "Access denied" error?

Magento Access denied error is the most common Magento error that appears when you try to access a webpage without having the right to enter it. It usually appears in the Magento admin when you use incorrect admin panel credentials, create a new user with the wrong user role, or install Magento 2 extensions.

How to Fix the "Access denied" error in Magento 2?

Now that you know the main reasons why the "Access denied" error might appear let's address them accordingly.

Solution 1. Get correct credentials

If you lost your admin panel credentials, the only way to restore them is through the database tables. Go to your database and run the following SQL query:

UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, 'YourNewPassword'), 256), ':', @salt, ':1') WHERE username = 'admin';

Now try to log in with the new password, if you can't log in, check 2 columns: first_failure and lock_expires in the admin_user table and set the value of these columns to null.

Solution 2. Assign proper user role

If you face the "Access denied" issue in Magento after you add a new user, most likely you haven't assigned a user role to them.

In this case log in with another user or ask the administrator to go to System > Permissions > All Users and assign your user to a certain user role.

Magento User Roles

Solution 3. Get permissions to access a particular extension

Since Magento doesn't update permissions to new extensions automatically, you might not have access to see new extension settings. 

It usually helps to re-login to the admin panel. However, if the Magento "Access denied" error remains, reset admin permissions.

  1. Go to System > Permissions > User Roles and find the role that the new extension is blocked for.
  2. Change Resource Access to All or some particular extension in the Role Resources section.

Magento Role Resources

Solution 4. Fix the system.xml and config.xml conflict

Sometimes it happens that after enabling some custom modules the "Access denied" issue in Magento 2  appears and prevents you from accessing the custom module.

Try to disable the extension and check whether the issue remains. If yes, check the system.xml and config.xml files. Some entries in the config.xml and system.xml might be missing. 

Now you should be able to fix "Access denied" error quickly and jump back to work with Magento admin right away. Regardless of whether you are a developer or not, you should know how to troubleshoot Magento to eliminate all possible issues and find solutions faster.

In case you have trouble fixing some issues yourself, consult the professionals. We at Magefan development company are always happy to assist.