Invalid token as suggest by lychee team maybe it's a yunohost issue

Hello,
after ( or six install, re-install of lychee i enconter always the same error.
I post on lychee github and it appear that the blocking token seems to be part of the security structure of yunohost.
An guy suggest to investigate in this direction.
He also suggest to modify the .env config file.
Many problems…

My YunoHost server

Hardware: computer at home / Linux 5.10.0-21-amd64 x86_64
CPU : AMD Ryzen 7 3700X 8-Core Processor (16 cores) Ram : 31.34 GB
YunoHost version: YunoHost 11.1.11.2 (stable)
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen | ALL 3
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain:
it’s a machine with several HD

*sda
├─sda1 1,1T /media/AAA
└─sda2 6,1T /media/VIDZ
*sdb 9,1T
└─sdb1 9,1T /media/10TERABYTES
*sdc 9,1T
├─sdc1 8,1T /media/10_Tera_V2
└─sdc2 1005,9G /media/BBB
*sdd 3,6T
└─sdd1 3,6T /media/3T—BK-up
*nvme0n1 931,5G
├─nvme0n1p1 /boot
├─nvme0n1p5 [SWAP]
└─nvme0n1p6 /
If your request is related to an app, specify its name and version: lychee Version : 4.7.0~ynh1
I post an issue on the Lychee github.
In the discussion this track emerge…

So the token is in fact a part of yunohost…!
How can we solve this issue…

thanks

I’m completely lost with just that description … The word “token” can mean anything, can you elaborate … Also what make you think it is “part of the security structure of YunoHost”

This whole thing could be related to the --auth_header option for permissions, but hard to say without a proper explanation of what the issue is …

Hello,
as i don’t find a solution on app yunohost forum, i try to ask on lychee github:

https://github.com/LycheeOrg/Lychee/issues/1767

After this discussion it appear that the error is a part of yunohost.

From the begining:
fresh install of yunohost 11.1.11.2 (stable)
fresh install of lychee
first run of lychee gives a 400 Bad Request Header Exception Invalid token
so no real solution here, and i ask directly on the github of lychee_ynh and after on lychee maison mère and
first there was an answer as above about ENABLE_TOKEN_AUTH
second at the end of the lychee github discussion an answer suggest that that token error is from the yunohost security policies.

Precisely in the
nano /var/www/lychee/.env
contain a token in his first line:

APP_NAME=Lychee
APP_ENV=production
APP_KEY=base64:hfytfuygjkhlkjmkj,mlk,kmljnjkhn=
APP_DEBUG=true
APP_URL=http://localhost

and on the GitHub - LycheeOrg/Lychee: A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos. we find :

Installation

To run Lychee, everything you need is a web-server with PHP 8.1 or later and a database (MySQL/MariaDB, PostgreSQL or SQLite). Follow the instructions to install Lychee on your server. This version of Lychee is built on the Laravel framework. To install:

  1. Clone this repo to your server and set the web root to lychee/public
  2. Run composer install --no-dev to install dependencies
  3. Copy .env.example as .env and edit it to match your parameters
  4. Generate your secret key with php artisan key:generate
  5. Migrate your database with php artisan migrate to create a new database or migrate an existing Lychee installation to the latest framework.

See detailed instructions on the Installation page of our documentation.

So the token is part of lychee … No answer and i’m feeling in a loop…

Hope it’s more explicit…

Thanks

Hello,
i follow the EricG https://forum.yunohost.org/u/ericg advice and i install the testing version of lychee.

I open the debug mode and i got a full error report.
I put all that lines here :slight_smile:
https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/5

thanks for helping

1 Like

Hello the version 3 is fine. Non error.
Thanks

Hello,
i find a solution and it was to put in
nano /var/www/lychee/.env
ENABLE_TOKEN_AUTH=false
i also enable debug…
There is still a problem in managing the token in yunohost…
as it is advice on this page:
https://lycheeorg.github.io/docs/configuration.html#authentication-guards
i restart the server and it seems to work…

yunohost 11.1.14 / litchee 4.7.2 ~ ynh2

Hello, I no longer have the token error problem, thank you !.
But now my photos are no longer showing, I see their locations and can download them. But no photos are visible.

Thanks

The log

> 2023-03-10 14:04:20 UTC -- notice  -- App\Http\Controllers\SessionController::login -- 62 -- User (olivier) has logged in from 37.169.5.134
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route api/search could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route about could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route config.json could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route login.action could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route v2/_catalog could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route login.action could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route api/search could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route config.json could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route about could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route v2/_catalog could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route .git/config could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route .env could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route info.php could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route .DS_Store could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route debug/default/view could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route .vscode/sftp.json could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route telescope/requests could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route s/135313e2332323e25363e22383/_/;/META-INF/maven/com.atlassian.jira/jira-webapp-dist/pom.properties could not be found.
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route .git/config could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route s/135313e2332323e25363e22383/_/;/META-INF/maven/com.atlassian.jira/jira-webapp-dist/pom.properties could not be found.; caused by
> 2023-03-10 11:34:08 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route telescope/requests could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route info.php could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route .vscode/sftp.json could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route .DS_Store could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route .env could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route debug/default/view could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route server-status could not be found.
> 2023-03-10 11:34:07 UTC -- error   -- Illuminate\Routing\AbstractRouteCollection::handleMatchedRoute -- 44 -- The route ecp/Current/exporttool/microsoft.exchange.ediscovery.exporttool.application could not be found.
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route server-status could not be found.; caused by
> 2023-03-10 11:34:07 UTC -- error   -- App\Http\Middleware\FixStatusCode::handle -- 30 -- The route ecp/Current/exporttool/microsoft.exchange.ediscovery.exporttool.application could not be found.; caused by
> 2023-03-10 10:46:28 UTC -- notice  -- App\Http\Controllers\SessionController::login -- 62 -- User (olivier) has logged in from 37.169.3.65
> 2023-03-10 10:45:08 UTC -- error   -- App\Http\Middleware\AdminUserStatus::handle -- 57 -- Admin user not found
> 2023-03-10 10:35:24 UTC -- notice  -- up -- 43 -- lychee_albums does not exist!
> 2023-03-10 10:35:23 UTC -- notice  -- up -- 66 -- lychee_settings does not exist!

About

Hello, i have the same problem before.
I have this log with Lychee 4.7.2~ynh3.

2023-03-11 09:20:51 UTC – warning – App\Metadata\Versions\GitHubVersion::isGit – 127 – could not read /var/www/lychee/.git/HEAD
2023-03-11 09:15:25 UTC – notice – App\Http\Controllers\SessionController::login – 62 – User (olivier) has logged in from 2a01:e0a:dc:84a0:3e2e:879e:c730:cdc8
2023-03-11 09:14:55 UTC – notice – App\Http\Controllers\SessionController::login – 62 – User (olivier@kevread.fr) has logged in from 2a01:e0a:dc:84a0:3e2e:879e:c730:cdc8
2023-03-11 08:50:47 UTC – notice – App\Http\Controllers\SessionController::login – 62 – User (olivier) has logged in from 2a01:e0a:dc:84a0:3e2e:879e:c730:cdc8
2023-03-11 08:50:20 UTC – error – App\Http\Middleware\AdminUserStatus::handle – 57 – Admin user not found
2023-03-11 08:43:18 UTC – notice – up – 43 – lychee_albums does not exist!
2023-03-11 08:43:18 UTC – notice – up – 66 – lychee_settings does not exist!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.