Let’s Fix Magento Login Issues Using Cookies and Sessions


Magento Fixing Guide

Hello, readers, if you are using Magento regularly, then this post is dedicated to you all. As we know that the Magento cookies create login problem for both customers front end and admins back end. So, this Magento issue where the same page keeps on popping when your username and password is correct will be tackled in this post.

By using the cookies and sessions, we will take different Magento Login issues and will try to find a lucrative solution for you guys.

A Cookie is a piece of text or information that web server can store in the hard drive of the web browser. A web server can withdraw the cookie after the completion of the task. Magento cookies are used in the Cart & Backend Admin functionalities and this is the cause of numerous Magento Login Issues.

The Session is the array variable on the web server side, it stores the information that is useful across the multiple pages. For example, when a user adds anything to the cart, then it is stored to the sessions. And, when the user exits the browser then the user checkouts from the session page.

Sessions are identified with the unique ID which is created according to the programming language used. Such as for PHP language “PHP ID Session” name will be listed. As you might have guessed by now that to run the session a cookie is saved on the browser of the user.

Magento Cookies & Issues

Magento has two cookies named ‘frontend’ and ‘adminhtml’. The first cookie is generated when the web page is browsed and when the customers log in to The web page. The second cookie is created when the back end user logins. You can check the Magento cookies by clicking Inspect Element > Application. Moreover, Cookies are configured in Magento via the Configuration admin menu – System > Configuration > General > Web.

Problematic Magento Login

Well, if you have tried to log in to the Magento and instead of inserting correct username and password, you are redirected to the same page and URL. Then, fella, this isn’t only you as every other customer front-end user and even the Magento backend admin have to face this problem. But, it doesn’t mean that if everybody is suffering, then you have to suffer also.

Usually, Magento login failure happens because of the following problems. So, just fix these problems and you will never have to suffer the login issue in Magento.

Problem 1:  Cookie Domain Doesn’t Match Your Server Domain

Suppose your site domain is http://www.com and your cookies domain is xxx.com. So, in this case, both Magento cookies will set for domain value xxx.com. But, your session will be the domain name through which you have logged in that’s http://www.com. So, the Magento session won’t be able to act in the server domain, then it will redirects you to the same page.

Solution: Simply change your Cookies Domain name from the Configuration admin menu.  to System > Configuration > General > Web. Alternatively, you can change this by running these SQL queries. For validating the cookie domain use this select query to get the configuration:

SELECT * FROM core_config_data WHERE path = ‘web/cookie/cookie_domain’;

Problem 2: Utilization of Multiple Subdomains & Incorrect Cookies Domain

On your staging site, you won’t be able to log in using following URL staging.example.com/admin. You might get login using staging.example.com, but when we log in again to example.com/admin, your next click on staging.example.com kicks you back to the login page. Similar behavior is experienced for customers using the front-end login as well.

Solution: Firstly, use change the Cookies Domain name from the Configuration admin menu as mentioned in problem one. Or, secondly, you can check whether your php.ini file has the same cookie domain as in your Magento config — if not change it to the same as the Magento config.

Problem 3: Failed To Create Session ID

This problem mainly is seen in the extensions log, and promptly seen in the PHP7 as it has strict type checking.

Solution: To solve this problem you have to change the Magento core read function by typecasting.

So, fellas, Magento is a good platform to create your website, but make sure to use correct cookies and sessions. Otherwise, Magento can be a bit frustrating to use.

About the author

Arpit Agarwal

I am a freelancer content writer, web developer and Video editor who loves to write technical stuff and on the other hand makes awesome videos as well. I like to make people happy with my writing and also try to make sure, you come back to read more.

By Arpit Agarwal

Most common tags

%d bloggers like this: