Magento Tutorials

Magento Admin Login Not Working Issue

Although you have entered the correct username and password, you still cannot access your Magento backend.

then…

You are redirected to the same login page.

Nothing happened!

How to resolve this issue? Here are some tips which may help you.

Why You Can’t Login To Magento Administrator?

The reason might be that you’re accessing the Magento website through the hostname localhost. Magento checks whether the hostname is a real domain name, and if it isn’t, it fails to create the right cookies.

  • Under Linux or MacOS you could try using localhost.localdomain.
  • Under Windows you have to modify your hosts file for this. Easier is just to use the IP-address 127.0.0.1 to access Magento.

Still Not Working? Here’s How to Fix Completely

If the solution above doesn’t work, follow the steps below:

  1. Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.
  2. Find the code:
session_set_cookie_params(

$this->getCookie()->getLifetime(),

$this->getCookie()->getPath(),

$this->getCookie()->getDomain(),

$this->getCookie()->isSecure(),

$this->getCookie()->getHttponly()

);

and replace it into this one:

session_set_cookie_params(

$this->getCookie()->getLifetime(),

$this->getCookie()->getPath()

//$this->getCookie()->getDomain(),

//$this->getCookie()->isSecure(),

//$this->getCookie()->getHttponly()

);
  1. Save the file. And try to login to your admin again.

Hope this helps!


Further Reading:

Magento Maintenance Mode
Magento 2 “Invalid Form Key”