InsideDarkWeb.com

SOLVED - Magento 2 - Unable to login to admin (no error message) stuck at login screen

This is not a question but rather an answer to a problem that is pretty old but recurring. I remember struggling on this back in the days when I was setting up Magento 1.9 and it occurred again this time around on Magento 2.1.4. I totally forgot about how I fixed it back then, so this time around I’m documenting my answer here in case someone needs it too.

Problem Statement

Basically, you were setting up your Magento 2.1 store, fulfilled all the server requirements, added SSL, setup your Website, Store and Store View and filled up the store configuration only to realise that suddenly you can’t login to the admin panel anymore. There are no errors, nothing in the browser console, neither any problem with the browser Chrome / Firefox. You clear the sessions and cache to no avail too. You found answers that keep pointing back to sessions and cache settings, but you did follow the documentation, and it still doesn’t work.

Magento Asked by Mubashar Aftab on February 17, 2021

8 Answers

8 Answers

Clearing cookies fixed it for me thanks. http://www.editthiscookie.com/

Answered by Liam Mitchell on February 17, 2021

Try loggin in from a different browser or clean the cookies on specific browser for the specific URL

Worked for me.

Answered by GiorgosK on February 17, 2021

Emergency Fix In local

Hello, If you are working in the local system and need to fix this issue urgently, So please follow the below steps.

I know this is not a proper solution but this is working fine in the local my system.

Open below file

/vendor/magento/module-backend/Model/Auth/Session.php

Comment 221 and 231 lines

    /**
     * Process of configuring of current auth storage when login was performed
     *
     * @return MagentoBackendModelAuthSession
     */
    public function processLogin()
    {
//        if ($this->getUser()) {
            $this->regenerateId();

            if ($this->_backendUrl->useSecretKey()) {
                $this->_backendUrl->renewSecretUrls();
            }

            $this->setIsFirstPageAfterLogin(true);
            $this->setAcl($this->_aclBuilder->getAcl());
            $this->setUpdatedAt(time());
//        }
        return $this;
    }

Answered by Deexit Sanghani on February 17, 2021

I had a similar problem. Everytime I tried to login, the form just reloaded without error.

It was because of a bad subdomain name. I choosed ee.test.example.com, which was causing the issue, because it indicates that it is a subdomain from a subdomain ee -> test -> example.com instead of ee-test -> example.com

I changed the name to ee-test.example.com and changed all occurenced in the database in the table core_config_data

SELECT * FROM `core_config_data` WHERE value LIKE "%ee.test.example.com%"

Answered by Black on February 17, 2021

Soon after the Magento Installation, if you are running into the below issues: a. The admin is not able to login after successful installation b. Magento2: Error 404 not found at the magento2 admin login page after successful installation. c. The links on the admin page not working.

Perform the below steps

a. Add the extra code to the **Validator.php** file which you will generally find from below given system path.
     Path: C:xampphtdocs<Your Magento Folder>vendormagentoframeworkViewElementTemplateFile

     /**
     * Checks whether path related to the directory
     *
     * @param string $path
     * @param string|array $directories
     * @return bool
     */
    protected function isPathInDirectories($path, $directories)
    {
        if (!is_array($directories)) {
            $directories = (array)$directories;
        }
        $realPath = $this->fileDriver->getRealPath($path);
        **$realPath = str_replace('\', '/', $realPath);   <<<====== Extra Code**
        foreach ($directories as $directory) {
            if (0 === strpos($realPath, $directory)) {
                return true;
            }
        }
        return false;
    }

b. This will regenerate all the files
      # php -d memory_limit=1G bin/magento setup:static-content:deploy -f


c. This will flush all the cache from the 2 directories var and generated
      Delete files form the folowing folders
        1. var 
        2. generated

This should fix the issue

Answered by Allen on February 17, 2021

I experienced this after setting up a new project done previously by the other devs. On my end, this is how I fixed this.

In core_config_data table, I searched for the path web/cookie/cookie_domain. And then found out that the domain is not the same with the current project's domain. So I just changed it to be same as the current project domain. And then after that, the admin login works.

Answered by phagento on February 17, 2021

Quick Fix:

Add or Update Web Url entries to https:// secure urls for below configuration entries in database

In Table > core_config_data set below value for your store:

  1. web/unsecure/base_url => 'https://yoursiteurl.com/'

  2. web/secure/base_url => 'https://yoursiteurl.com/'

Answered by Sachin on February 17, 2021

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.

Answered by Mubashar Aftab on February 17, 2021

Add your own answers!

Related Questions

How can I hide the store switcher

4  Asked on February 4, 2021 by nria

 

Magento 2 – Cant use product factory in plugin

1  Asked on February 3, 2021 by black

     

How to create custom link for category?

3  Asked on January 30, 2021 by r_solanki

   

Magento 2 cache_invalidate loop

2  Asked on January 29, 2021 by tjitse

     

Magento 2.2 ssh commands not executed

1  Asked on January 29, 2021 by jilco-tigchelaar

   

How to add new or customize existing top header links in Magento?

4  Asked on January 26, 2021 by tallal-hassan

     

Upload SVG files as product image

0  Asked on January 26, 2021 by francesco-terreni

         

Add custom parameter in order’s item in rest api magento 2

0  Asked on January 25, 2021 by vijay-gupta

 

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.