esbenp / lumen-api-oauth

The code for a blog post I wrote about creating web apps using a Lumen API that is authenticated by OAuth2
http://esbenp.github.io/2015/05/26/lumen-web-api-oauth-2-authentication/
61 stars 22 forks source link

Checking the scopes are not Working #11

Open Irtizashahid opened 9 years ago

Irtizashahid commented 9 years ago

my config/oauth2.php file

 'scope_param' => true,
 'default_scope' => 'basic',

routes.php Source

$app->group(['prefix' => 'api', 'middleware' => 'oauth:clientscope1'], function($app)
{
    $app->get('resource', function() {
        return response()->json([
            "id" => 1,
            "name" => "A resource"
        ]);
    });
});

Error log

ErrorException in Application.php line 1300: Undefined index: oauth:clientscope1

    in Application.php line 1300
    at Application->Laravel\Lumen\{closure}('8', 'Undefined index: oauth:clientscope1', '/opt/lampp/htdocs/lumenoauth/vendor/laravel/lumen-framework/src/Application.php', '1300', array('name' => 'oauth:clientscope1')) in Application.php line 1300
    at Application->Laravel\Lumen\{closure}('oauth:clientscope1')
    at array_map(object(Closure), array('oauth:clientscope1')) in Application.php line 1301
    at Application->gatherMiddlewareClassNames('oauth:clientscope1') in Application.php line 1164
    at Application->handleFoundRoute(array(true, array(object(Closure), 'middleware' => 'oauth:clientscope1'), array())) in Application.php line 1093
    at Application->Laravel\Lumen\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in OAuthExceptionHandlerMiddleware.php line 19
    at OAuthExceptionHandlerMiddleware->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
    at Pipeline->then(object(Closure)) in Application.php line 1317
    at Application->sendThroughPipeline(array('LucaDegasperi\OAuth2Server\Middleware\OAuthExceptionHandlerMiddleware', 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse'), object(Closure)) in Application.php line 1099
    at Application->dispatch(object(Request)) in Application.php line 1037
    at Application->run(object(Request)) in index.php line 34