I am getting the following error:
2019/08/06 00:34:09 [error] 13986#13986: *3095 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class 'Middleware\Authorization' not found in /home/user/api/app/middleware.php:5
Stack trace:
#0 /home/user/api/app/app.php(13): require()
#1 /home/user/api/public/index.php(3): require('/home/user/api/...')
#2 {main}
thrown in /home/user/api/app/middleware.php on line 5" while reading response header from upstream, client: 47.21.236.22, server: api.domain.com, request: "GET /v1/playlists/user2 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "api.domain.com"
I started the project with this skeleton:
I installed this OAuth2 middleware (as per instructions: composer require, etc.):
I pasted the following code to app/data/dependencies.php
:
use Chadicus\Slim\OAuth2\Middleware;
use OAuth2\Storage;
use OAuth2\GrantType;
$storage = new Storage\Memory(
[
'client_credentials' => [
'page-web' => [
'client_id' => pagewebu',
'client_secret' => 'abcdef123',
'scope' => 'apiUser',
],
],
]
);
$server = new OAuth2\Server( $storage, [ 'access_lifetime' => 3600 ], [ new GrantType\ClientCredentials($storage) ]);
I appended the following code to app/data/middleware.php
:
$authMiddleware = new Middleware\Authorization($server, $app->getContainer());
It seems that something is not loading somewhere but everything checks out. I don’t even know what else to check. I think I’ve done everything: composer dump-autoload, removing vendor
dir and installing everything with composer… all to no avail
Can someone please point me in the right direction?
Thank you,
-Leelz