{"action":"created","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/309","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/309/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/309/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/309/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/309","id":58594804,"number":309,"title":"Securing API endpoints L5","user":{"login":"sangar82","id":524030,"avatar_url":"https://avatars.githubusercontent.com/u/524030?v=3","gravatar_id":"","url":"https://api.github.com/users/sangar82","html_url":"https://github.com/sangar82","followers_url":"https://api.github.com/users/sangar82/followers","following_url":"https://api.github.com/users/sangar82/following{/other_user}","gists_url":"https://api.github.com/users/sangar82/gists{/gist_id}","starred_url":"https://api.github.com/users/sangar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sangar82/subscriptions","organizations_url":"https://api.github.com/users/sangar82/orgs","repos_url":"https://api.github.com/users/sangar82/repos","events_url":"https://api.github.com/users/sangar82/events{/privacy}","received_events_url":"https://api.github.com/users/sangar82/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-23T14:46:18Z","updated_at":"2015-02-24T09:36:28Z","closed_at":null,"body":"Hello Luca!\r\n\r\nHow can I secure my api endpoints in Laravel 5? \r\n\r\nIn Laravel 4, I do it:\r\n\r\n````php\r\nRoute::group(array('prefix' => 'api', 'before'=>'oauth'), function() {\r\n    ...\r\n});\r\n````\r\n\r\nBut L5 i have several errors when try to check the scope. It seems that the filter don't work well \r\n\r\n````php\r\n     Call to a member function hasScope() on null\r\n````\r\n\r\nI tried to add to the routeMiddleware array but didn't work.\r\nRoutes.php\r\n````php\r\n     Route::group(array('prefix' => 'v1', 'middleware'=>'oauth'), function() {\r\n````\r\n\r\nKernel.php\r\n````php\r\n\r\n\t/**\r\n\t * The application's route middleware.\r\n\t *\r\n\t * @var array\r\n\t */\r\n\tprotected $routeMiddleware = [\r\n\t\t'auth' => 'App\\Http\\Middleware\\Authenticate',\r\n\t\t'auth.basic' => 'Illuminate\\Auth\\Middleware\\AuthenticateWithBasicAuth',\r\n\t\t'guest' => 'App\\Http\\Middleware\\RedirectIfAuthenticated',\r\n\t\t'csrf' => 'App\\Http\\Middleware\\VerifyCsrfToken',\r\n        'oauth' => 'LucaDegasperi\\OAuth2Server\\Middleware\\OAuthExceptionHandlerMiddleware'\r\n\t]\r\n````"},"comment":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/comments/75725248","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/309#issuecomment-75725248","issue_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/309","id":75725248,"user":{"login":"sangar82","id":524030,"avatar_url":"https://avatars.githubusercontent.com/u/524030?v=3","gravatar_id":"","url":"https://api.github.com/users/sangar82","html_url":"https://github.com/sangar82","followers_url":"https://api.github.com/users/sangar82/followers","following_url":"https://api.github.com/users/sangar82/following{/other_user}","gists_url":"https://api.github.com/users/sangar82/gists{/gist_id}","starred_url":"https://api.github.com/users/sangar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sangar82/subscriptions","organizations_url":"https://api.github.com/users/sangar82/orgs","repos_url":"https://api.github.com/users/sangar82/repos","events_url":"https://api.github.com/users/sangar82/events{/privacy}","received_events_url":"https://api.github.com/users/sangar82/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T09:36:28Z","updated_at":"2015-02-24T09:36:28Z","body":"Solved! \r\n\r\nI forgot to add to .htaccess\r\n\r\n````\r\nRewriteEngine on\r\nRewriteCond %{HTTP:Authorization} ^(.*)\r\nRewriteRule .* - [e=HTTP_AUTHORIZATION:%1]\r\n````"}}