How to Fix: Admin Cannot Login in Magento 2
- January 10, 2024
- Posted by: Vijay Golani
- Category: Magento 2
Experiencing Login Issues with Magento 2 Admin
After updating your Magento store to the latest version and completing essential setup tasks, such as meeting server requirements, implementing SSL, configuring your Website, Store, and Store View, and providing details in the store configuration, you suddenly faced an issue where Magento 2 could no longer be logged into the admin panel.
Even after conducting thorough checks, there are no error messages or console issues in Chrome/Firefox. Clearing sessions and cache did not resolve the problem either. Despite finding answers that consistently point to sessions and cache settings, following the documentation did not resolve the issue.
Celebrate the fact that this article provides the solution you need.
Solving the Issue of Unable to Log in to Magento 2 Admin
Emergency Resolution for Magento 2 Admin Login Issue
Before moving forward, attempt the following steps to check if you can log in successfully.
The provided steps include accessing the database through phpMyAdmin and modifying specific values in the xxx_core_config_data table.
Step 1: Access your database using phpMyAdmin or a similar tool.
Step 2: Choose the xxx_core_config_data table (you can also substitute “xxx_” with your table prefix).
Step 3: Utilize the search function to locate rows containing “cookie” in the “path” column.
Step 4: Remove the values of the following paths, if they are present:
Step 5: Refresh the Magento admin page and try to log in.
Now, if you continue to face login issues even after following these steps, the problem may be different, and further investigation is recommended.
The Solution for Login Issues
If the issue of being unable to log in to the Magento 2 admin persists, it’s possible that another problem is arising from domain cookies. Often, instructions recommend setting the cookie domain as domain.com, assuming it’s a subdomain. However, if the store’s base URL is registered as http://domain.com, a conflict may arise at this point.
There are two ways to address this issue.
Solution 1: If you do not plan to use a subdomain for cookie storage
Navigate to Stores -> Configuration -> Web -> Cookie Domain, and set it as “domain.com” without a preceding period and parentheses.
Solution 2: If you are planning for a future that involves setting cookie storage
For the first solution, set the Cookie Domain as “.domain.com” with a preceding period and without parentheses. Then, in the base URL configuration under Stores -> Configuration -> Web -> Base URL, append “www” to your domain name, like http://www.domain.com. If SSL is implemented (which is recommended), ensure the secure base URL includes “https” as part of the setup.
The aforementioned solutions are our suggested recommendations for cases where Magento 2 encounters login issues in the admin panel. We hope these suggestions have successfully resolved your problem.
Evrig Solutions takes pride in being a prominent Magento 2 extension provider and ecommerce development service globally. With over 180+ extensions and various services, we aim to address all your challenges with your Magento store. If you encounter any issues with your Magento store, feel free to contact us for assistance.