Call to undefined method Laravel\Lumen\Routing\Router::dispatch()

Posted by

Error:

[2019-02-20 13:22:09] local.ERROR: League\OAuth2\Server\Exception\OAuthServerException: The resource owner or authorization server denied the request. in D:\laragon\www\auth-service-optimize\vendor\league\oauth2-server\src\Exception\OAuthServerException.php:215
Stack trace:
#0 D:\laragon\www\auth-service-optimize\vendor\league\oauth2-server\src\AuthorizationValidators\BearerTokenValidator.php(73): League\OAuth2\Server\Exception\OAuthServerException::accessDenied('Access token co...')
#1 D:\laragon\www\auth-service-optimize\vendor\league\oauth2-server\src\ResourceServer.php(84): League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator->validateAuthorization(Object(Zend\Diactoros\ServerRequest))
#2 D:\laragon\www\auth-service-optimize\vendor\laravel\passport\src\Guards\TokenGuard.php(174): League\OAuth2\Server\ResourceServer->validateAuthenticatedRequest(Object(Zend\Diactoros\ServerRequest))
#3 D:\laragon\www\auth-service-optimize\vendor\laravel\passport\src\Guards\TokenGuard.php(126): Laravel\Passport\Guards\TokenGuard->getPsrRequestViaBearerToken(Object(Laravel\Lumen\Http\Request))
#4 D:\laragon\www\auth-service-optimize\vendor\laravel\passport\src\Guards\TokenGuard.php(89): Laravel\Passport\Guards\TokenGuard->authenticateViaBearerToken(Object(Laravel\Lumen\Http\Request))
#5 D:\laragon\www\auth-service-optimize\vendor\laravel\passport\src\PassportServiceProvider.php(274): Laravel\Passport\Guards\TokenGuard->user(Object(Laravel\Lumen\Http\Request))
#6 [internal function]: Laravel\Passport\PassportServiceProvider->Laravel\Passport\{closure}(Object(Laravel\Lumen\Http\Request), NULL)
#7 D:\laragon\www\auth-service-optimize\vendor\illuminate\auth\RequestGuard.php(58): 

The error traceable logs looked like this. I’m not sure if this is relevant, however even though my credentials were valid, I don’t believe that they were rejected. It worked when I tried it with oauth/token as well. The error persists. I possess.

Solution:

The request that is dispatched is without the credentials added in the preceding line.

The reason being that Request::create returns a new request instance.

Add the request parameters in the newly created on $request and then dispatch it.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x