Emergency Fix
Whether or not this solution works, please try these steps first. You WILL be able to login which means you are on the right page. If you still could not login, your issue is most likely different than the one I'm posting, please proceed at your own risk.
- Go to your database. If you have phpMyAdmin, do the following:
- Click on your
xxx_core_config_data
table (xxx_ is the additional table prefix that you might have set during installation)
- Once the table is selected, hit the "search" tab on the right side
- In the search menu, under "path", select the dropdown to (LIKE %...%) and insert "cookie" in the field next to it. This will search for all table rows that contain "cookie" in their path value.
- Delete the VALUE of the following (if you do not see some of them, just ignore. It might not have been setup yet, so you can omit it):
web/cookie/cookie_domain
web/cookie/cookie_httponly
web/cookie/cookie_lifetime
web/cookie/cookie_path
That's it. Now, refresh your admin page and try logging in. It should work. If it does, now let's get to the crux of the problem.
The Issue
Most of the time, following the guide asks us to store the cookie domain as .domain.com which is expecting a sub-domain, but the store name is stored as http://domain.com
as it's base URL.
The Fix
There are two ways to fix this problem.
If you are not going to be using a subdomain for cookie storage, you can save the cookie domain settings in Stores -> Configuration -> Web -> Cookie Domain as (domain.com) without a preceding period and parentheses.
If you plan to make your store future-ready and allow subdomain cookie storage, you should set the Cookie Domain as (.domain.com
) with a preceding period and without the parentheses. However, in your base URL under Stores -> Configuration -> Web -> Base URL
, add www
to your domain name such as http://www.domain.com
and https
in the secure base URL if you are using SSL (that you should).
Additionally, other Cookie Settings are as such:
Cookie Lifetime
- 86400 (From my understanding, you don't need this and can leave it blank and check "use system value" because now Magento retains the session for security reasons).
Cookie Path
- /
Use HTTP Only
- Yes
Cookie Restriction Mode
- Up to you. If you enable this, it will show the message on the front end asking the user's consent to store cookies.
Note: Once again, this one is for my own future reference purposes and for anyone who might stumble into this frustration just like I did.