# \[lychee\] 400 Bad Request Header Exception Invalid token

**URL:** https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909
**Category:** Support apps
**Tags:** lychee, french
**Created:** [March 2, 2023, 3:14pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909 "2023-03-02T15:14:23Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 2, 2023, 3:14pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/1 "2023-03-02T15:14:23Z")

</div>

## 🇬🇧/🇺🇸

Hello  
I got these issue for several weeks.  
I don’t find solution and it happen on a fresh install.

### 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

### Description of my issue

**provide detailed error messages and logs if you can** :log for a new install : [https://paste.yunohost.org/raw/ajidigemaw](https://paste.yunohost.org/raw/ajidigemaw)

There is these line into logs :

\*2023-02-28 22:35:24,661: INFO - [##################..] \> Configuring permissions…  
\*2023-02-28 22:35:24,661: DEBUG - + ynh\_permission\_update --permission=main --add=visitors  
\*2023-02-28 22:35:24,711: DEBUG - + add=visitors  
&  
\*2023-02-28 22:35:24,995: INFO - [##################+.] \> Reloading NGINX web server…  
\*2023-02-28 22:35:24,995: DEBUG - + ynh\_systemd\_action --service\_name=nginx --action=reload

At the end we got:  
\*2023-02-28 22:35:25,093: INFO - [####################] \> Installation of lychee completed  
\*2023-02-28 22:35:25,093: DEBUG - + ynh\_exit\_properly  
\*2023-02-28 22:35:26,095: DEBUG - Checking that required services are up and running…  
\*2023-02-28 22:35:26,734: SUCCESS - Installation terminée

I perform a fresh install on a new yunohost instance.  
I just type the user/pass same as the user for nextcloud.  
and i got the error :  
[lychee] 400 Bad Request Header Exception Invalid token

* * *

## 🇫🇷

Bonjour  
Ce problème persiste…  
J’ai aussi mis quelquechose sur le github de yunohost

Je n’ai pas de solution, c’est une installation neve de ynohost et de lychee.  
Juste après le rensignement du user/pass ça plante en 400 Bad Request Header Exception Invalid token

**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)  
**accès server :** SSH | webadmin | direct accès via clavier / écran |  
**contexte** : oui  
**explication:**  
Machine avec plusieurs disques

\*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 /  
**version de l’app concernée:** lychee Version : 4.7.0~ynh1

### Description du problème

**logs** : [https://paste.yunohost.org/raw/ajidigemaw](https://paste.yunohost.org/raw/ajidigemaw)

dans les logs il y a :  
\*2023-02-28 22:35:24,661: INFO - [##################..] \> Configuring permissions…  
\*2023-02-28 22:35:24,661: DEBUG - + ynh\_permission\_update --permission=main --add=visitors  
\*2023-02-28 22:35:24,711: DEBUG - + add=visitors  
&  
\*2023-02-28 22:35:24,995: INFO - [##################+.] \> Reloading NGINX web server…  
\*2023-02-28 22:35:24,995: DEBUG - + ynh\_systemd\_action --service\_name=nginx --action=reload

mais à la fin on a  
\*2023-02-28 22:35:25,093: INFO - [####################] \> Installation of lychee completed  
\*2023-02-28 22:35:25,093: DEBUG - + ynh\_exit\_properly  
\*2023-02-28 22:35:26,095: DEBUG - Checking that required services are up and running…  
\*2023-02-28 22:35:26,734: SUCCESS - Installation terminée

Toute l’installation semble fonctionner;  
on peut acceder à une fenêtre de lychee qui demande un utilisateur mot de passe.  
Une fois renseignée ces deux infos l’erreur s’active :

hop un écran avec  
[lychee] 400 Bad Request Header Exception Invalid token

* * *

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 2, 2023, 3:28pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/2 "2023-03-02T15:28:26Z")

</div>

Hello,  
i also open an issue on lychee github 🙂

> <https://github.com/LycheeOrg/Lychee/issues/1767>
>
> \### Detailed description of the problem \[REQUIRED\]
> \*A clear and concise descrip…tion of what the bug is.\*
> After a fresh install on a newly install of yunohost i got a \[lychee\] 400 Bad Request Header Exception Invalid token
> \### Steps to reproduce the issue
> \*\*Steps to reproduce the behavior:\*\*
> 1. Go to 'lychee app on a YunoHost 11.1.11.2 (stable) '
> 2. Click on 'the app button, fill user/ pass and i got the issue'
> 
> 4. See error\*: 400 Bad Request Header Exception Invalid token
> 
> \*\*Screenshots\*\*
> \*If applicable, add screenshots to help explain your problem.\*
> 
> \### Output of the diagnostics \[REQUIRED\]
> \*(Settings =\> \[Diagnostics or https://example.com/Diagnostics or \`php artisan lychee:diagnostics\](https://paste.yunohost.org/raw/ajidigemaw)\`)\*
> 
> \### Browser and system
> firefox mint-001-1.0 and chromium Version 109.0.5414.119 (Build officiel) for Linux Mint (64 bits)
> copy of the post on yunohost forum :
> 
> \## :uk:/:us:   
> Hello
> I got these issue for several weeks.
> I don't find solution and it happen on a fresh install.
> 
> \### 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
> 
> \### Description of my issue
> 
> \*\*provide detailed error messages and logs if you can\*\*:log for a new install : https://paste.yunohost.org/raw/ajidigemaw
> 
> There is these line into logs :
> 
> \*2023-02-28 22:35:24,661: INFO - \[##################..\] \> Configuring permissions...
> \*2023-02-28 22:35:24,661: DEBUG - + ynh\_permission\_update --permission=main --add=visitors
> \*2023-02-28 22:35:24,711: DEBUG - + add=visitors
> &
> \*2023-02-28 22:35:24,995: INFO - \[##################+.\] \> Reloading NGINX web server...
> \*2023-02-28 22:35:24,995: DEBUG - + ynh\_systemd\_action --service\_name=nginx --action=reload
> 
> At the end we got:
> \*2023-02-28 22:35:25,093: INFO - \[####################\] \> Installation of lychee completed
> \*2023-02-28 22:35:25,093: DEBUG - + ynh\_exit\_properly
> \*2023-02-28 22:35:26,095: DEBUG - Checking that required services are up and running...
> \*2023-02-28 22:35:26,734: SUCCESS - Installation terminée
> 
> I perform a fresh install on a new yunohost instance.
> I just type the user/pass same as the user for nextcloud.
> and i got the error :
> \[lychee\] 400 Bad Request Header Exception Invalid token
> 
> \---------------------------------------------
> \## :fr: 
> Bonjour
> Ce problème persiste...
> J'ai aussi mis quelquechose sur le github de yunohost
> 
> Je n'ai pas de solution, c'est une installation neve de ynohost et de lychee.
> Juste après le rensignement du user/pass ça plante en 400 Bad Request Header Exception Invalid token
> 
> \*\*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)
> \*\*accès server :\*\* SSH | webadmin | direct accès via clavier / écran | 
> \*\*contexte\*\* : oui
> \*\*explication:\*\*
> Machine avec plusieurs disques
> 
> \*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 /
> \*\*version de l'app concernée:\*\* lychee Version : 4.7.0~ynh1
> 
> \### Description du problème
> 
> \*\*logs\*\*: https://paste.yunohost.org/raw/ajidigemaw
> 
> dans les logs il y a :
> \*2023-02-28 22:35:24,661: INFO - \[##################..\] \> Configuring permissions...
> \*2023-02-28 22:35:24,661: DEBUG - + ynh\_permission\_update --permission=main --add=visitors
> \*2023-02-28 22:35:24,711: DEBUG - + add=visitors
> &
> \*2023-02-28 22:35:24,995: INFO - \[##################+.\] \> Reloading NGINX web server...
> \*2023-02-28 22:35:24,995: DEBUG - + ynh\_systemd\_action --service\_name=nginx --action=reload
> 
> mais à la fin on a 
> \*2023-02-28 22:35:25,093: INFO - \[####################\] \> Installation of lychee completed
> \*2023-02-28 22:35:25,093: DEBUG - + ynh\_exit\_properly
> \*2023-02-28 22:35:26,095: DEBUG - Checking that required services are up and running...
> \*2023-02-28 22:35:26,734: SUCCESS - Installation terminée
>  
> Toute l'installation semble fonctionner;
> on peut acceder à une fenêtre de lychee qui demande un utilisateur mot de passe.
> Une fois renseignée ces deux infos l'erreur s'active :
> 
> hop un écran avec
> \[lychee\] 400 Bad Request Header Exception Invalid token
> 
> 
> \--------------------------------------------------
> 
> \### Steps to reproduce the issue
> \*\*Steps to reproduce the behavior:\*\*
> 1. Go to 'lychee app on a YunoHost 11.1.11.2 (stable) '
> 2. Click on 'the app button, fill user/ pass and i got the issue'
> 
> 4. See error\*: 400 Bad Request Header Exception Invalid token
> 
> \*\*Screenshots\*\*
> \*If applicable, add screenshots to help explain your problem.\*
> 
> \### Output of the diagnostics \[REQUIRED\]
> \*(Settings =\> \[Diagnostics or https://example.com/Diagnostics or \`php artisan lychee:diagnostics\](https://paste.yunohost.org/raw/ajidigemaw)\`)\*
> 
> \### Browser and system
> firefox mint-001-1.0 and chromium Version 109.0.5414.119 (Build officiel) for Linux Mint (64 bits)
> !\[Capture du 2023-03-02 16-21-50\](https://user-images.githubusercontent.com/74555046/222471534-4208a8e0-a335-4b77-a6fa-5ff83d065d92.png)
> !\[Capture du 2023-03-02 16-19-50\](https://user-images.githubusercontent.com/74555046/222471559-7555c660-db6e-4170-a752-5a3db0038f45.png)
> !\[Capture du 2023-03-02 16-24-55\](https://user-images.githubusercontent.com/74555046/222472138-cc160c6e-d05b-4e31-bd3f-f868ac6ae7c1.png)

crossing fingers

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 3, 2023, 9:51am UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/3 "2023-03-03T09:51:57Z")

</div>

Hello,  
i receive an email from [notifications@github.com](mailto:notifications@github.com)  
He gives us a track:

> My instincts tells me this is because you have a Bearer Token that is used by Yuno.

> [https://github.com/LycheeOrg/Lychee/blob/master/app/Services/Auth/SessionOrTokenGuard.php#L307](https://github.com/LycheeOrg/Lychee/blob/master/app/Services/Auth/SessionOrTokenGuard.php#L307) See here.

> I would suggest to edit your `.env` and set  
> `ENABLE_TOKEN_AUTH` to `false`

> see here: [https://github.com/LycheeOrg/Lychee/blob/master/config/auth.php](https://github.com/LycheeOrg/Lychee/blob/master/config/auth.php)

> This will disable the token authentication and skip this problem.

I find the .env in var

`Preformatted text` : nano /var/www/lychee/.env

**But it don’t work, nano said .env couldn’t be edit…**  
So several questions 🙂

1. Where is the .env file to modify it …?
2. does Yunohost got a token service to modify ?

Thanks for helping

---

<div class="post-metadata">

### Author: ![ericg](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ericg/32/1543_2.png) [@ericg](https://forum.yunohost.org/u/ericg)
#### Post date: [March 5, 2023, 6:38pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/4 "2023-03-05T18:38:49Z")

</div>

> Citation  
> 1.Where is the .env file to modify it …?

`sudo nano /var/www/lychee/.env`

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 6, 2023, 11:21am UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/5 "2023-03-06T11:21:48Z")

</div>

Hello,  
yes i open the 🙂

`sudo nano /var/www/lychee/.env`

but there is an alert message, read only etc you don’t have the privileges to change it.  
Even if i can modify it, i didn’t really do it.  
I saw the famous token but even if i added

`ENABLE_TOKEN_AUTH=false`  
nothing changes same error…  
So how works the security token in yunohost ?  
Is there a way to bypass ?

thanks

---

<div class="post-metadata">

### Author: ![ericg](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ericg/32/1543_2.png) [@ericg](https://forum.yunohost.org/u/ericg)
#### Post date: [March 6, 2023, 11:28am UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/6 "2023-03-06T11:28:18Z")

</div>

You can first `sudo su` to get root privilege and then edit the file. Alternatively you can upgrade to the testing branch: `sudo yunohost app upgrade lychee -u https://github.com/YunoHost-Apps/lychee_ynh/tree/testing`

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 6, 2023, 2:10pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/7 "2023-03-06T14:10:17Z")

</div>

Hello,  
i install the testing version and in  
`sudo nano /var/www/lychee/.env`  
i allow the debug mode…  
Hopefully i obtain a detailed error report 🙂

```auto
BadRequestHeaderException
in /var/www/lychee/app/Services/Auth/SessionOrTokenGuard.php (line 313)

        {
            $token = $this->request->headers->get(self::HTTP_TOKEN_HEADER);
            return is_string($token) && $token !== '' ? $this->provider->retrieveByCredentials([
                self::TOKEN_COLUMN_NAME => hash(self::TOKEN_HASH_METHOD, $token),
            ]) ?? throw new BadRequestHeaderException('Invalid token') : null;
        }
    }

SessionOrTokenGuard->getUserByToken() in /var/www/lychee/app/Services/Auth/SessionOrTokenGuard.php (line 149)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php -> user (line 57)
AuthManager->Illuminate\Auth\{closure}()
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php call_user_func (line 89)
AuthServiceProvider->Illuminate\Auth\{closure}()
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Http/Request.php call_user_func (line 606)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php -> user (line 39)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php -> Illuminate\Pipeline\{closure} (line 49)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php -> Illuminate\Pipeline\{closure} (line 121)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php -> handleStatefulRequest (line 64)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php -> Illuminate\Pipeline\{closure} (line 37)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php -> Illuminate\Pipeline\{closure} (line 67)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
Pipeline->Illuminate\Pipeline\{closure}() in /var/www/lychee/app/Http/Middleware/AcceptContentType.php (line 61)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
Pipeline->Illuminate\Pipeline\{closure}() in /var/www/lychee/app/Http/Middleware/AdminUserStatus.php (line 55)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
Pipeline->Illuminate\Pipeline\{closure}() in /var/www/lychee/app/Http/Middleware/InstallationStatus.php (line 55)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> Illuminate\Pipeline\{closure} (line 116)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php -> then (line 799)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php -> runRouteWithinStack (line 776)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php -> runRoute (line 740)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php -> dispatchToRoute (line 729)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php -> dispatch (line 190)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> Illuminate\Foundation\Http\{closure} (line 141)
in /var/www/lychee/vendor/livewire/livewire/src/DisableBrowserCache.php -> Illuminate\Pipeline\{closure} (line 19)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/bepsvpt/secure-headers/src/SecureHeadersMiddleware.php -> Illuminate\Pipeline\{closure} (line 20)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php -> Illuminate\Pipeline\{closure} (line 21)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php -> handle (line 31)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php -> Illuminate\Pipeline\{closure} (line 21)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php -> handle (line 40)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php -> Illuminate\Pipeline\{closure} (line 27)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php -> Illuminate\Pipeline\{closure} (line 86)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php -> Illuminate\Pipeline\{closure} (line 39)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
Pipeline->Illuminate\Pipeline\{closure}() in /var/www/lychee/app/Http/Middleware/FixStatusCode.php (line 30)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> handle (line 180)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> Illuminate\Pipeline\{closure} (line 116)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php -> then (line 165)
in /var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php -> sendRequestThroughRouter (line 134)
Kernel->handle() in /var/www/lychee/public/index.php (line 74)

```

So the error is more documented and maybe it gives you an idea to solve it…

and the stack trace 🙂

> BadRequestHeaderException
> 
> App\Exceptions\BadRequestHeaderException:  
> Invalid token
> 
> at /var/www/lychee/app/Services/Auth/SessionOrTokenGuard.php:313  
> at App\Services\Auth\SessionOrTokenGuard-\>getUserByToken()  
> (/var/www/lychee/app/Services/Auth/SessionOrTokenGuard.php:149)  
> at App\Services\Auth\SessionOrTokenGuard-\>user()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:57)  
> at Illuminate\Auth\AuthManager-\>Illuminate\Auth{closure}()  
> at call\_user\_func()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php:89)  
> at Illuminate\Auth\AuthServiceProvider-\>Illuminate\Auth{closure}()  
> at call\_user\_func()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Http/Request.php:606)  
> at Illuminate\Http\Request-\>user()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php:39)  
> at Illuminate\Session\Middleware\AuthenticateSession-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49)  
> at Illuminate\View\Middleware\ShareErrorsFromSession-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:121)  
> at Illuminate\Session\Middleware\StartSession-\>handleStatefulRequest()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:64)  
> at Illuminate\Session\Middleware\StartSession-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37)  
> at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:67)  
> at Illuminate\Cookie\Middleware\EncryptCookies-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/app/Http/Middleware/AcceptContentType.php:61)  
> at App\Http\Middleware\AcceptContentType-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/app/Http/Middleware/AdminUserStatus.php:55)  
> at App\Http\Middleware\AdminUserStatus-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/app/Http/Middleware/InstallationStatus.php:55)  
> at App\Http\Middleware\InstallationStatus-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116)  
> at Illuminate\Pipeline\Pipeline-\>then()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php:799)  
> at Illuminate\Routing\Router-\>runRouteWithinStack()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php:776)  
> at Illuminate\Routing\Router-\>runRoute()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php:740)  
> at Illuminate\Routing\Router-\>dispatchToRoute()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Routing/Router.php:729)  
> at Illuminate\Routing\Router-\>dispatch()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:190)  
> at Illuminate\Foundation\Http\Kernel-\>Illuminate\Foundation\Http{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:141)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/livewire/livewire/src/DisableBrowserCache.php:19)  
> at Livewire\DisableBrowserCache-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/bepsvpt/secure-headers/src/SecureHeadersMiddleware.php:20)  
> at Bepsvpt\SecureHeaders\SecureHeadersMiddleware-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)  
> at Illuminate\Foundation\Http\Middleware\TransformsRequest-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)  
> at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)  
> at Illuminate\Foundation\Http\Middleware\TransformsRequest-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)  
> at Illuminate\Foundation\Http\Middleware\TrimStrings-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)  
> at Illuminate\Foundation\Http\Middleware\ValidatePostSize-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:86)  
> at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)  
> at Illuminate\Http\Middleware\TrustProxies-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/app/Http/Middleware/FixStatusCode.php:30)  
> at App\Http\Middleware\FixStatusCode-\>handle()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)  
> at Illuminate\Pipeline\Pipeline-\>Illuminate\Pipeline{closure}()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116)  
> at Illuminate\Pipeline\Pipeline-\>then()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:165)  
> at Illuminate\Foundation\Http\Kernel-\>sendRequestThroughRouter()  
> (/var/www/lychee/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:134)  
> at Illuminate\Foundation\Http\Kernel-\>handle()  
> (/var/www/lychee/public/index.php:74)

Thanks for helping

---

<div class="post-metadata">

### Author: ![Vanitarium](https://forum.yunohost.org/user_avatar/forum.yunohost.org/vanitarium/32/3482_2.png) [@Vanitarium](https://forum.yunohost.org/u/Vanitarium)
#### Post date: [March 7, 2023, 1:22pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/8 "2023-03-07T13:22:04Z")

</div>

Hi , I had the same issue and thought if an app to be installed on my server has an error like this it is not a well maintained one. So, I uninstalled it and used a better managed app.  
Apps for yunohost should not have obvious errors like this one!! 😝

---

<div class="post-metadata">

### Author: ![ericg](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ericg/32/1543_2.png) [@ericg](https://forum.yunohost.org/u/ericg)
#### Post date: [March 7, 2023, 2:18pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/9 "2023-03-07T14:18:35Z")

</div>

> Citation  
> Apps for yunohost should not have obvious errors like this one!!

and still, at one point, they all have an “obvious errors like this one”…

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 7, 2023, 4:14pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/10 "2023-03-07T16:14:17Z")

</div>

So i’m on strike and so i got a moment to continue investigations…  
**I find a “solution”…**  
i describe it here 🙂  
[https://forum.yunohost.org/t/invalid-token-as-suggest-by-lychee-team-maybe-its-a-yunohost-issue/23950/5](https://forum.yunohost.org/t/invalid-token-as-suggest-by-lychee-team-maybe-its-a-yunohost-issue/23950/5)

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

**and now i’m in lychee… Youhou !**  
i put the diagnostic log here because it could be helpfull…

```auto
 Diagnostics
    -------
    Warning: /home/yunohost.app/lychee/uploads/ is owned by group www-data, but should be owned by one out of lychee
    Warning: /home/yunohost.app/lychee/uploads/ has permissions 0770, but should have 2775
    Warning: /home/yunohost.app/lychee/uploads/small is owned by group www-data, but should be owned by one out of lychee
    Warning: /home/yunohost.app/lychee/uploads/small has permissions 0770, but should have 2775
    Warning: /home/yunohost.app/lychee/uploads/raw is owned by group www-data, but should be owned by one out of lychee
    Warning: /home/yunohost.app/lychee/uploads/raw has permissions 0770, but should have 2775
    Warning: /home/yunohost.app/lychee/uploads/import is owned by group www-data, but should be owned by one out of lychee
    Warning: /home/yunohost.app/lychee/uploads/import has permissions 0770, but should have 2775
    Warning: /home/yunohost.app/lychee/uploads/big is owned by group www-data, but should be owned by one out of lychee
    Warning: /home/yunohost.app/lychee/uploads/big has permissions 0770, but should have 2775
    Warning: 3 more directories with wrong owner
    Warning: 3 more directories with wrong permissions
    Warning: Dropbox import not working. dropbox_key is empty.
    Warning: You may experience problems when uploading a photo of large size or handling many/large albums. Take a look in the FAQ for details.
    Warning: zend.assertions is disabled although Lychee is in debug mode. For easier debugging code generation for assertions should be enabled.
    Info: Latest version of PHP is 8.2
    Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone

    System Information
    --------------
    Lychee Version (release): 4.7.0
    DB Version: 4.7.0
    
    composer install: --no-dev
    APP_ENV: production
    APP_DEBUG: true
    
    System: Linux
    PHP Version: 8.1.16
    PHP User agent: Lychee/4 (https://lycheeorg.github.io/)
    Timezone: UTC
    Max uploaded file size: 512M
    Max post size: 512M
    Max execution time: 30
    MySQL Version: 10.5.18-MariaDB-0+deb11u1
    
    exec() Available: yes
    Imagick Available: 1
    Imagick Enabled: 1
    Imagick Version: 1691
    GD Version: 2.3.3
    Number of foreign key: 11 found.

    Config Information
    --------------
    version: 040700
    check_for_updates: 0
    sorting_photos_col: taken_at
    sorting_photos_order: ASC
    sorting_albums_col: max_taken_at
    sorting_albums_order: ASC
    imagick: 1
    skip_duplicates: 0
    small_max_width: 0
    small_max_height: 360
    medium_max_width: 1920
    medium_max_height: 1080
    lang: en
    layout: 1
    image_overlay_type: desc
    default_license: none
    compression_quality: 90
    grants_full_photo_access: 1
    delete_imported: 0
    mod_frame_enabled: 1
    mod_frame_refresh: 30
    thumb_2x: 1
    small_2x: 1
    medium_2x: 1
    landing_page_enable: 0
    site_owner: John Smith
    landing_title: John Smith
    landing_subtitle: Cats, Dogs & Humans Photography
    sm_facebook_url: https://www.facebook.com/JohnSmith
    sm_flickr_url: https://www.flickr.com/JohnSmith
    sm_twitter_url: https://www.twitter.com/JohnSmith
    sm_instagram_url: https://instagram.com/JohnSmith
    sm_youtube_url: https://www.youtube.com/JohnSmith
    landing_background: dist/cat.webp
    site_title: Lychee v4
    footer_show_copyright: 1
    site_copyright_begin: 2019
    site_copyright_end: 2019
    footer_additional_text:                  
    footer_show_social_media: 0
    public_search: 0
    SL_enable: 0
    SL_for_admin: 0
    public_recent: 0
    recent_age: 1
    public_starred: 0
    grants_download: 0
    photos_wraparound: 1
    map_display: 0
    zip64: 1
    map_display_public: 0
    map_provider: Wikimedia
    force_32bit_ids: 0
    map_include_subalbums: 0
    update_check_every_days: 3
    has_exiftool: 1
    share_button_visible: 0
    import_via_symlink: 0
    has_ffmpeg: 1
    location_decoding: 0
    location_decoding_timeout: 30
    location_show: 1
    location_show_public: 0
    rss_enable: 0
    rss_recent_days: 7
    rss_max_items: 100
    prefer_available_xmp_metadata: 0
    editor_enabled: 1
    lossless_optimization: 0
    swipe_tolerance_x: 150
    swipe_tolerance_y: 250
    local_takestamp_video_formats: .avi|.mov
    log_max_num_line: 1000
    unlock_password_photos_with_url_param: 0
    nsfw_visible: 1
    nsfw_blur: 0
    nsfw_warning: 0
    nsfw_warning_admin: 0
    nsfw_banner_override:                    
    map_display_direction: 1
    album_subtitle_type: oldstyle
    upload_processing_limit: 4
    public_photos_hidden: 1
    new_photos_notification: 0
    legacy_id_redirection: 1
    zip_deflate_level: 6
    SA_enabled: 1
    default_album_protection: 1
    album_decoration: layers
    album_decoration_orientation: row
    allow_username_change: 1

```

thanks

---

<div class="post-metadata">

### Author: ![Lep0le](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@Lep0le](https://forum.yunohost.org/u/Lep0le)
#### Post date: [March 10, 2023, 6:55pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/11 "2023-03-10T18:55:58Z")

</div>

Hello,  
new issue 🙂  
when you change the PHP-FPM configuration settings from low to high on visual yunohost admin page of lychee app…  
it break the lychee app impossible to login again.

I mean even if you change the settings back to default low value, it’s finish.

No time to check the files in php by ssh…  
Logs here:  
[https://paste.yunohost.org/raw/cawiweyiqe](https://paste.yunohost.org/raw/cawiweyiqe)  
advises welcome…  
thanks

---

<div class="post-metadata">

### Author: ![system](https://forum.yunohost.org/uploads/default/original/2X/f/f59fe8e3ee6b100b4f574d30d6e30479c68b89f0.png) [@system](https://forum.yunohost.org/u/system)
#### Post date: [March 25, 2023, 6:56pm UTC](https://forum.yunohost.org/t/lychee-400-bad-request-header-exception-invalid-token/23909/12 "2023-03-25T18:56:18Z")

</div>

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