# Fatal error:  Uncaught exception 'Enlight\_Controller\_Exception' with message 'Unauthorized'

**URL:** <https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100>\
**Category:** Installation/Einstieg\
**Created:** [7. März 2016 um 18:35 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100 "2016-03-07T18:35:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![megloff](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@megloff](https://forum.shopware.com/u/megloff)\
**Post date:** [7. März 2016 um 18:35 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/1 "2016-03-07T18:35:58Z")

</div>

Hallo zusammen

Ich habe eine Shopware 5 Live Umgebung in eine Testumgebung auf Linux „kopiert“ gemäss der folgenden Anleitung.

[http://community.shopware.com/Shop-Transfer-Live-System-Testumgebung\_detail\_1309.html](http://community.shopware.com/Shop-Transfer-Live-System-Testumgebung_detail_1309.html)

Beim Login ins Backend erhalte ich folgende Fehlermeldung und kann nicht auf die Menüs zugreifen. Cache [var/cache/clear\_cache.sh] und Attribute update [bin/console sw:generate:attributes] habe ich mittels der console und script auf dem Terminal ausgeführt ohne Fehler. die Live und Testumgebung sind auf dem selben Server und nutzen die gleiche Domain. Nur die Url ist jeweils anders. d.h.&nbsp; Live Umgebung auf [xxxx.com/shop](http://xxxx.com/shop) und Test auf [xxxx.com/test](http://xxxx.com/test).

Das Frontend selber funktioniert.Nur das Backend sheppert.

Irgendwelche vorschläge was man tun kann?

```
Fatal error: Uncaught exception 'Enlight_Controller_Exception' with message 'Unauthorized' in /var/www/vhosts/skate.ch/httpdocs/test/engine/Shopware/Controllers/Backend/Index.php:211
Stack trace:
#0 /var/www/vhosts/skate.ch/httpdocs/test/engine/Library/Enlight/Controller/Action.php(158): Shopware_Controllers_Backend_Index->loadAction()
#1 /var/www/vhosts/skate.ch/httpdocs/test/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('loadAction')
#2 /var/www/vhosts/skate.ch/httpdocs/test/engine/Library/Enlight/Controller/Front.php(226): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#3 /var/www/vhosts/skate.ch/httpdocs/test/engine/Shopware/Kernel.php(153): Enlight_Controller_Front->dispatch()
#4 /var/www/vhosts/skate.ch/httpdocs/test/vendor/symfony/http-kernel/HttpCache/HttpCache.php(492): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#5 /var/www/ in /var/www/vhosts/skate.ch/httpdocs/test/engine/Shopware/Controllers/Backend/Index.php on line 211
503 Service Unavailable

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [7. März 2016 um 18:59 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/2 "2016-03-07T18:59:15Z")

</div>

Hallo,

also die Fehlermeldung sagt nur aus, dass du auf einen Bereich zugreifen willst, für den du keine Rechte hast. Benutzt du vielleicht einen eingeschränkten Benutzer?  
&nbsp;

Moritz

---

<div class="post-metadata">

**Author:** ![megloff](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@megloff](https://forum.shopware.com/u/megloff)\
**Post date:** [7. März 2016 um 19:27 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/3 "2016-03-07T19:27:33Z")

</div>

Merci für die Antwort. Nein den gleichen Benutzer wie auf der Liveumgebung. DB wurde kopiert und URL gemäss Anleitung in der DB angepasst.

---

<div class="post-metadata">

**Author:** ![megloff](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@megloff](https://forum.shopware.com/u/megloff)\
**Post date:** [7. März 2016 um 19:57 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/4 "2016-03-07T19:57:54Z")

</div>

Glaube habe ein Lösungsansatz gefunden. Habe gesehen das in der DB in der Tabelle&nbsp; “s\_core\_auth” einen Eintrag für “sessionID” sowie ein “disabled\_cache” flag gibt. Ich habe mal für meinen User das “sessionID” Feld geleert und “disabled\_cache” auf 1 gesetzt. Danach konnte ich einloggen, Fehler erschien nachher nicht mehr und ich konnte auf das GUI zugreifen. Ob und welches der beiden Einstellungen nun genützt hat bin ich mir nicht sicher, aber es schein nun wieder zu gehen.

Hat jemand eine Idee wann die “sessionID” im Backend jeweils neu erzeugt wird und wo der “Backend” Cache für die User abgelegt wird?&nbsp;

Gruss  
Mark

&nbsp;

---

<div class="post-metadata">

**Author:** ![WOLLkenSchaf](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@WOLLkenSchaf](https://forum.shopware.com/u/WOLLkenSchaf)\
**Post date:** [16. Januar 2017 um 12:13 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/5 "2017-01-16T12:13:25Z")

</div>

Hallo,

habe leider ein ähnliches Problem. Live Shop in Unterordner verschoben … Automatisches Update von SW 5.1.0 nach 5.2.14 ohne Fehlermeldungen durchgeführt …  
Frontend geht, Backend erst csrfProtection-Fehlermeldung … csrfProtection hab ich dann über config deaktiviert&nbsp;… nun ging der&nbsp;Login und es kam folgende Fehlermeldung bei der ich nicht weiter komme:

```
Pfad der Anforderung: /xxx/backend/Index/load/

Ups! Ein Fehler ist aufgetreten!

Die nachfolgenden Hinweise sollten Ihnen weiterhelfen.

Unauthorized in engine/Shopware/Controllers/Backend/Index.php on line 222
Stack trace:

#0 engine/Library/Enlight/Controller/Action.php(159): Shopware_Controllers_Backend_Index->loadAction()
#1 engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('loadAction')
#2 engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#3 engine/Shopware/Kernel.php(179): Enlight_Controller_Front->dispatch()
#4 vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#5 engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#6 vendor/symfony/http-kernel/HttpCache/HttpCache.php(258): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#7 engine/Shopware/Components/HttpCache/AppCache.php(103): Symfony\Component\HttpKernel\HttpCache\HttpCache->pass(Object(Symfony\Component\HttpFoundation\Request), true)
#8 shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#9 {main}

```

Den Trick von megloff hab ich schon versucht, leider kein Erfolg.&nbsp;  
Freue mich über jeden Vorschlag.

Gruss Paul

---

<div class="post-metadata">

**Author:** ![Jan\_Bucker](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@Jan\_Bucker](https://forum.shopware.com/u/Jan_Bucker)\
**Post date:** [17. Januar 2017 um 10:21 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/6 "2017-01-17T10:21:27Z")

</div>

Das Problem tritt seit dem neuen Session-Handling ab 5.2.13 auf und ist auf die Grundeinstellung “PHP-Timeout” zurückzuführen. Ist das Timeout auf Kein (0 Sek.) gesetzt, werden die Sessions direkt invalidiert.

Mit der kommenden Version 5.2.15 wird das Problem behoben sein. Bis dahin kann der kaputte Zustand mit dem Query aus dem Ticket repariert werden:  
[Shopware Issuetracker](https://issues.shopware.com/issues/SW-17484)

LG, Jan

---

<div class="post-metadata">

**Author:** ![WOLLkenSchaf](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@WOLLkenSchaf](https://forum.shopware.com/u/WOLLkenSchaf)\
**Post date:** [17. Januar 2017 um 10:45 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/7 "2017-01-17T10:45:38Z")

</div>

Ohman und das soll man wissen? ![Grin](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/70033cde8e8ff79cfa538293ae71318d6f788423.png "Grin")

Vielen Dank, mit der Lösung aus dem Ticket ging es ohne Probleme. ![Smile](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/bac5f5766b6a20565a8fb995345b4e41d24daac0.png "Smile")

LG Paul

---

<div class="post-metadata">

**Author:** ![vanwittlaer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/vanwittlaer/32/8499_2.png) [@vanwittlaer](https://forum.shopware.com/u/vanwittlaer)\
**Post date:** [23. Januar 2017 um 10:34 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/8 "2017-01-23T10:34:39Z")

</div>

Bei uns präzise das gleiche Problem … siehe unten. Keiner der beiden oben beschriebenen Lösungsansätz hat geholfen. SW 5.2.14 mit PHP 7.0. (Bei PHP 5.6 ist alles ok.) Was könnte man noch probieren?

Grüsse,  
Geert

`Ups! Ein Fehler ist aufgetreten!`

`Die nachfolgenden Hinweise sollten Ihnen weiterhelfen. `

`Unauthorized in engine/Shopware/Controllers/Backend/Index.php on line 222`

`Stack trace:`

`#0 engine/Library/Enlight/Controller/Action.php(159): Shopware_Controllers_Backend_Index->loadAction() #1 engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('loadAction') #2 engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp)) #3 engine/Shopware/Kernel.php(179): Enlight_Controller_Front->dispatch() #4 vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Enlight_Controller_Request_RequestHttp), 1, true) #5 engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL) #6 vendor/symfony/http-kernel/HttpCache/HttpCache.php(258): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true) #7 engine/Shopware/Components/HttpCache/AppCache.php(103): Symfony\Component\HttpKernel\HttpCache\HttpCache->pass(Object(Symfony\Component\HttpFoundation\Request), true) #8 shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request)) #9 {main}`

---

<div class="post-metadata">

**Author:** ![vanwittlaer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/vanwittlaer/32/8499_2.png) [@vanwittlaer](https://forum.shopware.com/u/vanwittlaer)\
**Post date:** [23. Januar 2017 um 18:36 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/9 "2017-01-23T18:36:16Z")

</div>

So, gerade ist die 5.2.15 herausgekommen und schon installiert - der Fehler bleibt leider genau der gleiche. Hat jemand 'ne Idee, warum das bei uns nur mit PHP 7.0 auftritt, mit 5.6 aber in Ordnung ist?

Gruss

Geert&nbsp;

---

<div class="post-metadata">

**Author:** ![SieGeL](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@SieGeL](https://forum.shopware.com/u/SieGeL)\
**Post date:** [14. März 2017 um 09:30 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/10 "2017-03-14T09:30:35Z")

</div>

Hi,

ich hatte das selbe Problem, dass der Backend Login mit der Version 5.2.20 nicht funktioniert hat, habe immer diese Fehlermeldung erhalten:

Unauthorized in engine/Shopware/Controllers/Backend/Index.php on line 222

Bei mir war suhosin unter PHP 7.0.16 aktiviert, scheinbar hat der Shop ein Problem, wenn Suhosin die Sessions verschlüsselt…ich konnte das Problem beheben, in dem ich folgende Suhosin Einstellung geändert habe:

**suhosin.session.encrypt=off**

Danach hat bei mir der Login im Backend problemlos funktioniert.

Gruß

Sascha

&nbsp;

---

<div class="post-metadata">

**Author:** ![vanwittlaer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/vanwittlaer/32/8499_2.png) [@vanwittlaer](https://forum.shopware.com/u/vanwittlaer)\
**Post date:** [14. März 2017 um 15:23 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/11 "2017-03-14T15:23:04Z")

</div>

Hi Sascha,

also, gerade noch mal alles kontrolliert & CSRF-Protection auch für Backend ausgeschaltet. Dann hakte es noch am SW-Lizenz-Manager (der ja Ioncube braucht was aber auf unserer PHP 7 nicht installiert ist). Damit scheint jetzt alles prima zu gehen.

Grüße

Geert

PS. Suhosin mag unserer Hoster für PHP 7 noch gar nicht installieren ;-( Vermute das Problem lag bei uns eher am CSRF-Protection.

---

<div class="post-metadata">

**Author:** ![SieGeL](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@SieGeL](https://forum.shopware.com/u/SieGeL)\
**Post date:** [14. März 2017 um 16:43 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/12 "2017-03-14T16:43:17Z")

</div>

Hi Geert,

das würde ich dann auch vermuten, die CSRF Protection hatte ich auch abgeschaltet bei mir, das hatte aber leider keinen Effekt 😕

Erst nach dem Abschalten der gecrypteten Sessions funktionierte es dann.

Btw: Für PHP 7 gibt es übrigens den IonCube Loader 6.0.9, der läuft problemlos mit PHP 7 zusammen.

Viele Grüße

Sascha

---

<div class="post-metadata">

**Author:** ![essa.anid](https://avatars.discourse-cdn.com/v4/letter/e/3ec8ea/32.png) [@essa.anid](https://forum.shopware.com/u/essa.anid)\
**Post date:** [20. Januar 2022 um 13:54 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-enlight-controller-exception-with-message-unauthorized/35100/13 "2022-01-20T13:54:03Z")

</div>

you have to implement CSRFWhitelistAware (getWhitelistedCSRFActions function) in your backend controller

use Shopware\Components\CSRFWhitelistAware;

class Shopware\_Controllers\_Backend\_YOURCONTROLLER

extends \Shopware\_Controllers\_Backend\_ExtJs implements CSRFWhitelistAware  
{  
public function getWhitelistedCSRFActions()  
{  
return [‚test‘];  
}  
public function testAction()  
{…}  
}
