Missing \"Authorization\" header im Admin-Bereich

Ein Einloggen im Admin-Bereich ist problemlos im Localhost möglich. Checke ich dann aber die AJAX-Request, sehe ich folgende Fehlermeldung:

{
"errors": [
{
"code": "9",
"status": "401",
"title": "The resource owner or authorization server denied the request.",
"detail": "Missing \"Authorization\" header",
"meta": {
"trace": [
{
"file": "/var/www/html/vendor/league/oauth2-server/src/AuthorizationValidators/BearerTokenValidator.php",
"line": 93,
"function": "accessDenied",
"class": "League\\OAuth2\\Server\\Exception\\OAuthServerException",
"type": "::"
},
{
"file": "/var/www/html/vendor/shopware/core/Framework/Api/OAuth/BearerTokenValidator.php",
"line": 43,
"function": "validateAuthorization",
"class": "League\\OAuth2\\Server\\AuthorizationValidators\\BearerTokenValidator",
"type": "->"
},
{
"file": "/var/www/html/vendor/league/oauth2-server/src/ResourceServer.php",
"line": 84,
"function": "validateAuthorization",
"class": "Shopware\\Core\\Framework\\Api\\OAuth\\BearerTokenValidator",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/Framework/Api/EventListener/Authentication/ApiAuthenticationListener.php",
"line": 105,
"function": "validateAuthenticatedRequest",
"class": "League\\OAuth2\\Server\\ResourceServer",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
"line": 117,
"function": "validateRequest",
"class": "Shopware\\Core\\Framework\\Api\\EventListener\\Authentication\\ApiAuthenticationListener",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 230,
"function": "__invoke",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 59,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/Content/Flow/Dispatching/FlowDispatcher.php",
"line": 54,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/Framework/Webhook/WebhookDispatcher.php",
"line": 99,
"function": "dispatch",
"class": "Shopware\\Core\\Content\\Flow\\Dispatching\\FlowDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/Framework/Event/BusinessEventDispatcher.php",
"line": 53,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Webhook\\WebhookDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/Framework/Event/NestedEventDispatcher.php",
"line": 38,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Event\\BusinessEventDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
"line": 154,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Event\\NestedEventDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpKernel.php",
"line": 151,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpKernel.php",
"line": 75,
"function": "handleRaw",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/Kernel.php",
"line": 202,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php",
"line": 86,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
"line": 479,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler",
"type": "::"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
"line": 452,
"function": "forward",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
"line": 346,
"function": "fetch",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "->"
},
{
"file": "/var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php",
"line": 224,
"function": "lookup",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/HttpKernel.php",
"line": 154,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "->"
},
{
"file": "/var/www/html/vendor/shopware/core/HttpKernel.php",
"line": 79,
"function": "doHandle",
"class": "Shopware\\Core\\HttpKernel",
"type": "->"
},
{
"file": "/var/www/html/public/index.php",
"line": 85,
"function": "handle",
"class": "Shopware\\Core\\HttpKernel",
"type": "->"
}
],
"file": "/var/www/html/vendor/league/oauth2-server/src/Exception/OAuthServerException.php",
"line": 243
}
}
]
}

Das selbe passiert auch, wenn ich nicht meine eigene Config nutze, sondern zum Beispiel docker run --rm -p 80:80 dockware/dev:latest nutze.

Ich habe schon viel probiert, kann aber nicht wirklich sagen, woher der Fehler herkommt. Nutze ein M1 Macbook, wenn das hilft.

Ich habe mittlerweile mitbekommen, dass ein White Screen nach dem login auftaucht. Dort wird auch ein Token übergeben. Allerdings werde ich danach nicht weitergeleitet.


Moin Marius :slight_smile:
wir haben gerade das gleiche Problem. Wie hast du das bei dir / euch gelöst?
Hoffe du kannst mir weiterhelfen!

Hi

I don’t know German or Dutch but i have the same issue and i fixed it. After login token was generated but i see blank screen and unable to see the dashboard. The issue was with the .htaccess file in public folder. please update the file. I used the following code for .htaccess file.

BEGIN Shopware

The directives (lines) between „# BEGIN Shopware“ and „# END Shopware“ are dynamically generated. Any changes to the directives between these markers will be overwritten.

DirectoryIndex index.php

Options -MultiViews RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]

# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]

<IfModule !mod_rewrite.c>

RedirectMatch 302 ^/$ /index.php/

Header set Content-Security-Policy "script-src 'none'"

END Shopware