Skip to main content
42 votes

Unable to login to admin (no error message) stuck at login screen

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 ...
Mubashar Aftab's user avatar
21 votes
Accepted

Magento 2: How to use Cookie?

app/code/Custom/Module/view/frontend/templates/sample.phtml <script type="text/javascript"> require([ 'jquery', 'jquery/jquery.cookie' ], function ($) { ...
Jackson's user avatar
  • 9,939
17 votes

Unable to login to admin (no error message) stuck at login screen

Well, there could be a number of reasons and it's not just like a cookie issue cause it really depends on the version you're running on. Here are the steps Make sure that you will take a backup of the ...
samumaretiya's user avatar
12 votes

Magento 2: How to use Cookie?

In the target.phtml, add js codes like below. Set the cookies <script> require([ 'jquery', 'jquery/jquery.cookie' ], function ($) { $.cookie('cookie_name', 'value',...
Key Shang's user avatar
  • 3,425
11 votes

Magento 2: How to use Cookie?

You can store cookie in js file using below method, define([ 'jquery', 'mage/cookies' ], function ($) { $.cookie('cookiename', cookievalue); });
Rakesh Jesadiya's user avatar
9 votes

Magento 2: How to use Cookie?

Use mage/cookies as jquery/jquery.cookie is removed in 2.4.5 define([ 'jquery', 'mage/cookies' ], function ($) { $.cookie('cookiename', cookievalue); });
puntable's user avatar
  • 528
9 votes

How to set cookie in magento 2?

Create Cookie We will be creating a test controller to create app/code/[Name_Space]/[Your_Module]/Controller/Cookie/Addcookie.php <?php namespace [Name_Space]\[Your_Module]\Controller\Cookie; ...
Asheem Patro's user avatar
  • 1,070
9 votes

Edit the default Magento2 cookie message

Try following: Copy file to your frontend theme and update text as you want. FROM: vendor/magento/module-cookie/view/frontend/templates/html/notices.phtml TO: app/design/frontend/[VendorName]/[...
Pratik Oza's user avatar
  • 3,992
7 votes

Magento 2: Why the customer can't login on chrome browser?

If you are working in local setup, Change row web/unsecure/base_url value of localhost to your IP in core_config_data table. localhost can be changed to 127.0.0.1 We can also create a virtual host ...
Amit Singh's user avatar
  • 1,775
7 votes

Unable to login to admin (no error message) stuck at login screen

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. ...
phagento's user avatar
  • 539
6 votes

Customer Login Doesn't Work in Magento 1.9

As the issue seems to be cookie-related, try increasing the cookie lifetime to 86400 under System -> Configuration -> Web -> Session and Cookie Management The reason may be, by default ...
Anshu Mishra's user avatar
  • 8,990
6 votes

How to set cookie in magento 2?

Set the cookies <script> require([ 'jquery', 'mage/cookies' ], function ($) { $.cookie('cookie_name', 'value', { path: '/' });//Set the cookies }); </...
Key Shang's user avatar
  • 3,425
6 votes
Accepted

How to get Cookies already set on the browser

You can try the below code to get cookie. <?php namespace Training\Rememberme\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Config\ScopeConfigInterface; use ...
Jjo's user avatar
  • 1,168
6 votes

Unable to send the cookie. Maximum number of cookies would be exceeded Magento 2.1.5

Extend in di.xml <preference for="Magento\Framework\Stdlib\Cookie\PhpCookieManager" type="Project\Cookies\PhpCookieManager" /> <?php namespace Project\Cookies; class ...
Primož Klemenšek's user avatar
6 votes
Accepted

M2 > Recently viewed cookie lifetime

You just need to set below configuration Stores > Configuration > Catalog > Catalog > Recently Viewed/Compared Products > Lifetime of products in Recently Viewed Widget You can set any higher ...
Devidas's user avatar
  • 3,358
5 votes

Sharing Sessions Between Stores with Different Domains

You can share frontend cookie between magento website with different domains using that solution ainixon.me/set-cookie-on-cross-domains. You need to create cookies.php file with the following code &...
electroid's user avatar
  • 358
5 votes

Magento 2 set cookie on a phtml file

Magento 2 cookie will not work when cache is enabled. You have to make your phtml file uncacheable. Use cacheable="false" property in your xml. <block class="Magento\Framework\View\Element\...
Dinesh Yadav's user avatar
  • 6,465
5 votes

Unable to login to admin (no error message) stuck at login screen

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: web/unsecure/base_url => ...
Sachin's user avatar
  • 111
5 votes
Accepted

How to enable cookies in Magento 2.x

Magento Admin > Stores > Settings / Configuration > General / Web > Default Cookie Settings
Jonathan Ribas's user avatar
5 votes
Accepted

Mage.Cookies what for?

AFAIK it's used only in two places on CE: In app/design/frontend/base/default/template/page/html/cookienotice.phtml : <script type="text/javascript"> /* <![CDATA[ */ function ...
Raphael at Digital Pianism's user avatar
5 votes
Accepted

How to set a mage/cookies cookie expiration date to the user's session

$.mage.cookies.set('name', 'value', {lifetime: -1}); Which seems a little crazy, but here's why... The source for mage/cookies can be found lib/web/mage/cookies.js. The set method, at least in 2....
Pmclain's user avatar
  • 2,648
5 votes

Magento 2.3.2 Unable to send the cookie. Size of 'mage-messages' is 4191 bytes

The error is because in the cookie mage-messages exists exception trace. Try to increase the value of \Magento\Framework\Stdlib\Cookie\PhpCookieManager::MAX_COOKIE_SIZE = 40960; And see in a browser ...
Piston Awesome's user avatar
5 votes
Accepted

Magento2.3: This page isn’t working, 127.0.0.1 redirected you too many times

Try to run below command once php bin/magento config:set web/secure/use_in_adminhtml 0 php bin/magento config:set web/cookie/cookie_domain '' php bin/magento setup:upgrade php bin/magento cache:clean ...
Kishan Savaliya's user avatar
4 votes

Magento customer login and admin login session/cookie issue

You need to force Magento to use the same cookie domain in all cases. This solution was tested on Magento 1.9.2.4 When the Session Cookie Management variables are not set incorrectly Magento may ...
Stephen Fox's user avatar
4 votes

Unable to login to admin (no error message) stuck at login screen

In my case I forgot to set config value ture for use secur admin url. I read in your statement, you mentioned that SSL is installed, Please check if admin url is being opened as secure ( using https://...
Kapil Dev Singh's user avatar
4 votes

Unable to login to admin (no error message) stuck at login screen

There is two to there cases for the issue: Open the core_config_data table Find the web/cookie/cookie_domain and update you domin name If Your domain is secure then add the https:// in you domin ...
Prince Kumar's user avatar
4 votes

Unable to send the cookie. Maximum number of cookies would be exceeded Magento 2.1.5

I Was able to solved this problem by increase const MAX_COOKIE_SIZE = 40960; public_html/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php const MAX_NUM_COOKIES = 50; const ...
Yustian's user avatar
  • 143
4 votes

messageManager addSuccessMessage/addErrorMessage set cookies?

I have also faced this similar issue and I got this resolved by implementing complex messages, like this: Also you can include any custom html in any message also with this technique. Implementing ...
Narendra Vyas's user avatar
4 votes

Magento 2.3.2 Unable to send the cookie. Size of 'mage-messages' is 4191 bytes

Something is being set in the cookie that exceeds the size. This probably isn't expected behavior. To see what is being set, open vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php and change ...
Peter Jaap Blaakmeer's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible