magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Admin Login doesn't work after updating to 2.1.0 #5309

Closed gewaechshaus closed 7 years ago

gewaechshaus commented 8 years ago

Hey there,

after an update to v2.1.0 via composer and CL setup:upgrade/ setup:di:compile we aren't able to log in our admin area while frontend logins seems to work.

The error message is

  Your current session has been expired.

We're saving sessions as files. I noticed that the DB got some entries in admin_user_session, all containing the wrong (localhost) IP (fixed). This is related to our haproxy->varnish->nginx->php7.0-fpm setup, but did work before... So my first question, does this table normally appear even if M2 stores session as files?

As M2.1.0 required an update from PHP-FPM 7.0.4 -> 7.0.8 this could also be issued by the php update. 2nd question: did anybody stumple upon the same problems?

Best regards Jan

sIiiS commented 8 years ago

I have this issue too in my localhost without any additional configuration

gewaechshaus commented 8 years ago

While using localhost as your domain name?

sIiiS commented 8 years ago

@gewaechshaus, yes I am in local and admin area has issue

isols commented 8 years ago

The same story (but upgraded via Admin - ubuntu 16.04 nginx php-fmp 7.0.8, admin_user_session truncated, running on domain.)

gewaechshaus commented 8 years ago

Our related system is also running on Ubuntu 16.04... So this seems to be reproducible.

sIiiS commented 8 years ago

I am in localhost with windows 10, AMPPS and php 5.6 with Apache Is there any solution ?

gewaechshaus commented 8 years ago

Can be temporary fixed by setting the

 session.cookie_lifetime 86400
 session.gc_maxlifetime 86400

 Table core_config_data -> admin/security/session_lifetime -> 86400

so this issue should be related to localization/time...

sIiiS commented 8 years ago

@gewaechshaus, this solution doesn't work for me!

gewaechshaus commented 8 years ago

@sIiiS - https://alankent.me/2015/04/25/use-of-localhost-when-installing-magento-2-quick-note/

gewaechshaus commented 8 years ago

https://github.com/magento/magento2/issues/5383

sIiiS commented 8 years ago

@gewaechshaus, when I talk about localhost it doesn't mean that I use http://localhost in my brower. I use http://192.168.1.10 in browser and thank you it seems the solution #5383 worked for me

amenk commented 8 years ago

admin/security/session_lifetime -> 86400 worked for me. Before this change, the key was empty. Maybe this is (no longer) supported?

csdougliss commented 8 years ago

Same issue here. Clean install of 2.1.0. Use data migration tool 2.1.0.

Setting 86400 above worked for me

EugeneVdovenko commented 8 years ago

I have same trouble after updare. Change php-settings and value in db work for me

belovanton commented 8 years ago

I have same trouble after update.

amitsamtani commented 8 years ago

@gewaechshaus thank you, your solution worked for me.

session.cookie_lifetime 86400 session.gc_maxlifetime 86400

Table core_config_data -> admin/security/session_lifetime -> 86400

fruitbakje commented 8 years ago

With a clean install it still doesn't work for me. I added the row into the core_config_data table (it didn't exist yet), edited my .htaccess file with

php_value session.cookie_lifetime 86400
php_value session.gc_maxlifetime 86400

and I edited the file as described in #5383

As everyone else can actually circumvent this issue, I'm probably doing something wrong here. Any suggestions are welcome!

ArtemPopenko commented 8 years ago

Seems it is magneto core bug, comming from megento security module. As temporary solution set the cookies for using domain: loggedOutReasonCode = 1 and you will be logged in. https://api.monosnap.com/rpc/file/download?id=mzB1fIOpgLfU1JVs61TFpHgILp15Vl

kcanters commented 8 years ago

How can 1 set the cookies for using domain: loggedOutReasonCode = 1

ravibhoraniya commented 8 years ago

Admin Side login that time session expired

msg is : capture

give solution

sidealice commented 7 years ago

same problem and fixed( using Asia timezone, web installation and install use domain with non default port)

first step: find "admin/security/session_lifetime" in table core_config_data. if not exist create one and set value to 86400

second step: clean cache (remove var/cache)

login and fix

igor-krupa commented 7 years ago

@ravibhoraniya i had the same issue. If nothing from above helped try to change PHP version. After changing from PHP-7.0.7 to 5.6.19 it works. It should work also on 7.0.11.

VincentMarmiesse commented 7 years ago

I had the same issue. Adding admin/security/session_lifetime to 86400 in core_config_data and flushing the cache solved it.

bin/magento config:set admin/security/session_lifetime 86400
bin/magento cache:flush
gritdigital-mibu commented 7 years ago

Thank you @VincentMarmiesse How is this not fixed in 4 months?

vagrant@vagrant:/vagrant/public_html$ php -v PHP 7.0.22-1~dotdeb+8.1 (cli) ( NTS )

Clean install of Magento 2.1.8 and I'm having to "fix" problems before I've even started?

magento-engcom-team commented 7 years ago

@gewaechshaus , thank you for your report. We were not able to reproduce this issue by following the steps you provided. Please provide more detailed steps to reproduce or try to reproduce this issue on a clean installation or latest release.

gritdigital-mibu commented 7 years ago

@magento-engcom-team I had the same problem and it was because my installation had not completely finished due to PHP max_execution_time. I presume this may be the same cause for the OP.

magento-engcom-team commented 7 years ago

@gewaechshaus, thank you for your report. We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue. We tested the issue on 2.2.0, 2.1.9

folkevil commented 6 years ago

I got the same problem when deployed, using 2.1.5, PHP 5.6, Centos 7. But everything worked fine on Windows.

ghost commented 6 years ago

@sidealice, It worked for me too thanks.

" first step: find "admin/security/session_lifetime" in table core_config_data. if not exist create one and set value to 86400

second step: clean cache (remove var/cache)

login and fix "

Oreolek commented 6 years ago

Can confirm the problem on a clean Docker install (alexcheng/magento2 image)

VincentMarmiesse commented 6 years ago

FYI, I still have the issue on a clean 2.2.5 install. It works after setting the session lifetime as described here

mautz-et-tong commented 6 years ago

I can confirm this issue on a 2.2.5. Fix above doesn't work

FrancYescO commented 5 years ago

After like 12h of troubleshooting i've found that created_at column got the wrong ON UPDATE CURRENT_TIMESTAMP attribute that instead should go to the updated_at

this is how the table should appear: image

there are the query that fixed for me

ALTER TABLE `admin_user_session` CHANGE `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created Time';
ALTER TABLE `admin_user_session` CHANGE `updated_at` `updated_at` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Update Time';