Sorry for opening this new issue but I really think it's a bug in the oauth2 module or an incomplete documentation.
I followed the instructions and figured out my problem: The app crashes with a ServiceNotCreatedException and the message "AuthenticationInterface service is missing". But if I make a print_r($container) in routes.php, the interface is correctly listed under aliases.
<?php
declare(strict_types=1);
use MyProject\Api\Handler\HomePageHandler;
use MyProject\Api\Handler\PingHandler;
use Psr\Container\ContainerInterface;
use Zend\Expressive\Application;
use Zend\Expressive\Authentication\AuthenticationMiddleware;
use Zend\Expressive\Authentication\OAuth2\TokenEndpointHandler;
use Zend\Expressive\MiddlewareFactory;
return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container) : void {
$app->post('/oauth2/token', TokenEndpointHandler::class);
$app->get('/', HomePageHandler::class, 'home');
$app->get('/api/ping', [
AuthenticationMiddleware::class,
PingHandler::class,
], 'api.ping');
};
[ ] I was not able to find an open or closed issue matching what I'm seeing.
Sorry for opening this new issue but I really think it's a bug in the oauth2 module or an incomplete documentation.
I followed the instructions and figured out my problem: The app crashes with a ServiceNotCreatedException and the message "AuthenticationInterface service is missing". But if I make a
print_r($container)
in routes.php, the interface is correctly listed under aliases.config/autoload/dependencies.global.php
config/autoload/oauth2.global.php
config/routes.php
Provide a narrative description of what you are trying to accomplish.
Code to reproduce the issue
Expected results
Actual results