I'm very new in zend-expressive and used the skeleton app as entry point. Now I want to protect my API using zend-expressive-authentication-oauth2 and have some problems to get it working. The system is PHP 7.2 (Debian) and all packages installed via composer in the latest versions.
I followed the instructions to install and configure the module: I created the *.key files under data/oauth, used the SQL script to create the database tables and made the modifications in the app configs.
What happens is that I get an HTTP 500 error if I call the following URL in a browser:
example.com/api/ping
And the same if I post client credentials to the URL:
example.com/oauth2/token
So I guess there's something wrong with the configuration. Unfortunately the error page displays no concrete error message so debugging is quite difficult. But I try to show my files so exact as possible.
config/config.php
$aggregator = new ConfigAggregator([
\Zend\Expressive\Authentication\ConfigProvider::class,
// ...
MyProject\Api\ConfigProvider::class,
new PhpFileProvider(realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php'),
], $cacheConfig['config_cache_path']);
<?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.
I'm very new in zend-expressive and used the skeleton app as entry point. Now I want to protect my API using zend-expressive-authentication-oauth2 and have some problems to get it working. The system is PHP 7.2 (Debian) and all packages installed via composer in the latest versions.
I followed the instructions to install and configure the module: I created the *.key files under
data/oauth
, used the SQL script to create the database tables and made the modifications in the app configs.What happens is that I get an HTTP 500 error if I call the following URL in a browser:
And the same if I post client credentials to the URL:
So I guess there's something wrong with the configuration. Unfortunately the error page displays no concrete error message so debugging is quite difficult. But I try to show my files so exact as possible.
config/config.php
config/autoload/dependencies.global.php
config/autoload/oauth2.global.php
config/autoload/pipeline.php
No modifications.
config/routes.php
Provide a narrative description of what you are trying to accomplish.
Code to reproduce the issue
Expected results
Actual results