Post by drrevans » Mon Jan 03, 2022 8:33 am

I am trying to add products and when I click to edit the image to add a new image, it kicks me back to the login screen with the message Invalid Token Session. The session id in the table is unque so it is not the problem I read regarding no primary key in it. It only happens when I click to edit the image. If I save before I click to edit that image, I retain the information that I put in.
Last edited by drrevans on Thu Jan 13, 2022 9:22 pm, edited 1 time in total.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by by mona » Mon Jan 03, 2022 11:20 am

The "invalid session token" message (should be "invalid user token") is given when the user_token variable in your session does not match the user_token variable in your url or when there is no user_token variable in your url (then they obviously also do not match).
When signed in, all urls should have the user_token variable which is continuously matched with the one in the session.
So this is a case of a link which does not append the user_token correctly to the url.
My guess is a modification you installed.

There is no OC version posted .. it may be related viewtopic.php?t=187435 .. the session token sounds like something from OC1

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by drrevans » Mon Jan 03, 2022 12:58 pm

by mona wrote:
Mon Jan 03, 2022 11:20 am
The "invalid session token" message (should be "invalid user token") is given when the user_token variable in your session does not match the user_token variable in your url or when there is no user_token variable in your url (then they obviously also do not match).
When signed in, all urls should have the user_token variable which is continuously matched with the one in the session.
So this is a case of a link which does not append the user_token correctly to the url.
My guess is a modification you installed.

There is no OC version posted .. it may be related viewtopic.php?t=187435 .. the session token sounds like something from OC1
This is the message I was getting: Invalid token session. Please login again. The OC version is 3.0.3.8.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by drrevans » Mon Jan 03, 2022 11:37 pm

It doesn't do this all the time. I did a refresh and I was able to upload some images but now it is back doing it as I try to apply the image to a particular product.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Tue Jan 04, 2022 12:05 am

Use your web browser's developer tool Network tab and check the request to admin/index.php?route=common/filemanager&user_token=xxx, on clicking the edit image, is the same token as the page that requested it.

Also try the Disable cache option in the developer tool to eliminate it being a caching issue.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by straightlight » Tue Jan 04, 2022 12:50 am

drrevans wrote:
Mon Jan 03, 2022 11:37 pm
It doesn't do this all the time. I did a refresh and I was able to upload some images but now it is back doing it as I try to apply the image to a particular product.
Server Error logs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by drrevans » Tue Jan 04, 2022 6:17 am

straightlight wrote:
Tue Jan 04, 2022 12:50 am
drrevans wrote:
Mon Jan 03, 2022 11:37 pm
It doesn't do this all the time. I did a refresh and I was able to upload some images but now it is back doing it as I try to apply the image to a particular product.
Server Error logs.
I am working on this Xampp. I wanted to get it working right before applying it to my host site. I may just upload what I got working to my site to see if I am still getting these session errors.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by straightlight » Tue Jan 04, 2022 7:47 am

drrevans wrote:
Tue Jan 04, 2022 6:17 am
straightlight wrote:
Tue Jan 04, 2022 12:50 am
drrevans wrote:
Mon Jan 03, 2022 11:37 pm
It doesn't do this all the time. I did a refresh and I was able to upload some images but now it is back doing it as I try to apply the image to a particular product.
Server Error logs.
I am working on this Xampp. I wanted to get it working right before applying it to my host site. I may just upload what I got working to my site to see if I am still getting these session errors.
See the error logs in your OC admin > systems - > maintenance > error logs or in your system/storage/logs folder.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by drrevans » Thu Jan 06, 2022 6:55 pm

ADD Creative wrote:
Tue Jan 04, 2022 12:05 am
Use your web browser's developer tool Network tab and check the request to admin/index.php?route=common/filemanager&user_token=xxx, on clicking the edit image, is the same token as the page that requested it.

Also try the Disable cache option in the developer tool to eliminate it being a caching issue.
I am using Xampp for the local host. Could this be part of the issue? I was trying to get it to work here first.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Thu Jan 06, 2022 8:51 pm

Shouldn't be a problem using XAMPP as long as everything is set up correctly.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by by mona » Thu Jan 06, 2022 9:35 pm

I am not sure what assistance you want
by mona wrote:
Mon Jan 03, 2022 11:20 am
When signed in, all urls should have the user_token variable which is continuously matched with the one in the session.
by mona wrote:
Mon Jan 03, 2022 11:20 am
My guess is a modification you installed.
straightlight wrote:
Tue Jan 04, 2022 12:50 am
Server Error logs.
ADD Creative wrote:
Tue Jan 04, 2022 12:05 am
check the request to admin/index.php?route=common/filemanager&user_token=xxx, on clicking the edit image, is the same token as the page that requested it.
and your response
drrevans wrote:
Thu Jan 06, 2022 6:55 pm
I am using Xampp for the local host.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by Gergely » Thu Jan 06, 2022 10:20 pm

Hi drrevans,

I have two guesses what this could be:
  1. Modification bug, as mona suggested.
  2. Workflow issues.
Let me elaborate!
1. Modification bug
Do you have any extensions / modifications installed on your admin that could affect your edit product page or image manager? If so, check if the user_token is included in the query when you "click to edit the image to add a new image". As ADD Creative already suggested. Please note: a modification could be the problem even if you don't think it should affect the mentioned areas.
2. Workflow issues
It is possible to re-login into the same session from the same browser in different tabs. This will create a new user_token and update it in the session, causing the tabs that were open previously to no longer "work" as these will still be using the old user_token. So you could technically fork the user_token in the same browser, this could easily happen while testing multiple things at the same time on a local copy. For example: logging in again after opening an id anchor in a new tab or navigating to the admin page from a browser bookmark in a new tab. To prevent this from happening, try to avoid logging in to the same session again. If you need multiple tabs open, you could log in to a new session in another browser or using incognito mode.

These are of course just guesses, and it could be a third (or fourth) scenario. In either case, XAMPP is unlikely to be causing this issue (as long as your environment is set up correctly)

Hope this helps,
Gergely

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by JNeuhoff » Fri Jan 07, 2022 8:00 pm

@Gergely: In Firefox at least, opening multiple browser tabs does not cause the creation of a new session for the same website!

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Gergely » Sat Jan 08, 2022 12:27 am

JNeuhoff wrote:
Fri Jan 07, 2022 8:00 pm
@Gergely: In Firefox at least, opening multiple browser tabs does not cause the creation of a new session for the same website!
No, it doesn't create a new session. However, it's possible to log in again on a new tab, causing the user_token to be updated for the open session. Now the previously loaded tabs that have been loaded with a previous token are deprecated, and any action on them will redirect to the login page with OP's error message. This, of course, will not be OP's issue if this behaviour is exclusive to the edit picture button on the images tab...

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by drrevans » Thu Jan 13, 2022 9:54 am

I think I have narrowed more information on this error. This only happens when I try to upload images. Well now I am getting a Directory not found prior to being kicked out. My config has this as to where the images are: define('DIR_IMAGE', '/home/users/web/b2285/ipg.drrevans/wp_site_1626524447/reunion/image/'); My site and the admin are missing images. They are in that folder but this is not what the code is expecting. I have read that it wants absolute value. When google this - Opencart problem image manager Warning! Directory Does not Exist - many people have had this issue but I am not seeing a resolution. I believe if I fixed that, this issue goes away.

This is what is stored in the image column in the product table: catalog/demo/htc_touch_hd_1.jpg - the full path is image/catalog/demo

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Thu Jan 13, 2022 5:10 pm

DIR_IMAGE should match DIR_APPLICATION, except with /image/ instead of /admin/. This will need to be an absolute path, not a symbolic link. The image part of the URL is added by model_tool_image->resize.

If you are getting 'Warning: Directory does not exist!'. Either, your path is wrong, there is a file/folder permissions issue or your DIR_IMAGE has a symbolic link.

It would be helpful to answer some of the questions other users have asked you in order to help you.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by drrevans » Thu Jan 13, 2022 9:28 pm

ADD Creative wrote:
Thu Jan 13, 2022 5:10 pm
DIR_IMAGE should match DIR_APPLICATION, except with /image/ instead of /admin/. This will need to be an absolute path, not a symbolic link. The image part of the URL is added by model_tool_image->resize.

If you are getting 'Warning: Directory does not exist!'. Either, your path is wrong, there is a file/folder permissions issue or your DIR_IMAGE has a symbolic link.

It would be helpful to answer some of the questions other users have asked you in order to help you.
I had checked the permission and they were fine. I asked my host for the absolute path and they gave it to me and when I put that there it worked:
this is what I originally had it as:
define('DIR_IMAGE', '/home/users/web/b2285/ipg.drrevans/wp_site_1626524447/reunion/image/')

they changed it to this:
define('DIR_IMAGE', '/hermes/bosnacweb05/bosnacweb05bi/b2285/ipg.drrevans/wp_site_1626524447/reunion/image/');

Now my site is working and I can now load images and I don't get the session token error nor the Directory not found.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am

Post by ADD Creative » Thu Jan 13, 2022 11:31 pm

It's a known issue with symbolic links in the image config paths. There is another workaround that may help if you have the issue in the future. https://github.com/opencart/opencart/is ... -445841482

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by drrevans » Sat Jan 15, 2022 12:16 am

ADD Creative wrote:
Thu Jan 13, 2022 11:31 pm
It's a known issue with symbolic links in the image config paths. There is another workaround that may help if you have the issue in the future. https://github.com/opencart/opencart/is ... -445841482
I have bookmarked that link as it will come in handy. Thanks.

New member

Posts

Joined
Mon Nov 29, 2021 1:31 am
Who is online

Users browsing this forum: No registered users and 75 guests