Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-631 API error "Class \"Slim\\Http\\Stream\" not found" #21

Open
wants to merge 1 commit into
base: release/17.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Oauth/Oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use League\OAuth2\Server\AuthorizationServer;
use FreePBX\modules\Api\Oauth\Repositories;
use FreePBX\modules\Api\Oauth\Entities\UserEntity;
use Slim\Http\Stream;
use GuzzleHttp\Psr7\Stream;
use League\OAuth2\Server\Exception\OAuthServerException;
use Psr\Container\ContainerInterface;

Expand Down Expand Up @@ -165,6 +165,8 @@ function (ContainerInterface $container) {
return $server;
}
);
$container->set('api', fn() => $this->freepbx);
$container->set('freepbx', fn() => $this->freepbx);
AppFactory::setContainer($container);
$app = AppFactory::create();
$app->get('/authorize', function ($request, $response, $args) use ($app) {
Expand Down Expand Up @@ -223,7 +225,6 @@ function (ContainerInterface $container) {
}
});
$app->post('/token', function ($request, $response, $args) use ($app) {
dbug($request->getParsedBody());
$authorizationServer = $app->getContainer()->get(AuthorizationServer::class);
try {
// Try to respond to the request
Expand All @@ -234,7 +235,6 @@ function (ContainerInterface $container) {
return $exception->generateHttpResponse($response);

} catch (\Exception $exception) {
dbug($exception->getMessage());
// Unknown exception
$body = new Stream('php://temp', 'r+');
$body->write($exception->getMessage());
Expand Down