Login redirect when trying to login to Commerce Admin

This article gives the possible solutions for the Commerce Admin login issue, where you are redirected back to the login form when trying to log in to the Admin, and no error message is displayed. These include correcting the server timezone settings and clearing the cookies settings in Adobe Commerce.

Description description

Environment

  • Adobe Commerce (all supported versions and editions)

Issue/Symptoms

  • After entering valid credentials and selecting Sign in, the login process does not complete.
  • The Admin redirects back to the login page.
  • You can’t access the Commerce Admin.

Steps to reproduce

  • Go to your Commerce Admin page.
  • Enter your credentials and click Sign in.

Cause

  • Incorrect timezone set on browser level, which leads to the admin session being considered expired even if its actual lifetime hasn’t yet expired.
  • Incorrect cookies settings, which leads to the established session not being used by Adobe Commerce.

Resolution resolution

Admin session lifetime issue

Try to use a different browser and increase the admin session lifetime if it is less than one hour.

To increase the admin session lifetime, take the following steps:

  1. Create a database backup.

  2. Use a database tool such as phpMyAdmin, or access the DB manually from the command line to run the following SQL query:

    code language-none
    UPDATE core_config_data SET value = 7200 WHERE path = 'admin/security/session_lifetime';
    
  3. Clean the configuration cache by running the following command:

    code language-none
    php <your_magento_install_dir>/bin/magento cache:clean config
    

Incorrect cookies settings

To check the cookies settings values and clear them, take the following steps:

  1. Create a database backup.

  2. Use a database tool such as phpMyAdmin, or access the DB manually from the command line to run the following SQL query:

    code language-none
    SELECT * FROM core_config_data WHERE (path = "web/cookie/cookie_domain" OR path = "web/cookie/cookie_path");
    
  3. If the values’ responses are not empty, set them to NULL by running the following SQL query:

    code language-none
    UPDATE core_config_data SET value = NULL WHERE (path = "web/cookie/cookie_domain" OR path = "web/cookie/cookie_path");
    
  4. Clean the configuration cache by running the following command:

    code language-none
    php <your_magento_install_dir>/bin/magento cache:clean config
    
recommendation-more-help
experience-cloud-kcs-help-kbarticles