{"action":"created","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/614","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/614/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/614/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/614/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/614","id":119896789,"number":614,"title":"Oauth server issue with token authentication","user":{"login":"jonathanlundstrom","id":4216027,"avatar_url":"https://avatars.githubusercontent.com/u/4216027?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanlundstrom","html_url":"https://github.com/jonathanlundstrom","followers_url":"https://api.github.com/users/jonathanlundstrom/followers","following_url":"https://api.github.com/users/jonathanlundstrom/following{/other_user}","gists_url":"https://api.github.com/users/jonathanlundstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanlundstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanlundstrom/subscriptions","organizations_url":"https://api.github.com/users/jonathanlundstrom/orgs","repos_url":"https://api.github.com/users/jonathanlundstrom/repos","events_url":"https://api.github.com/users/jonathanlundstrom/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanlundstrom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/labels/question","name":"question","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"milestone":null,"comments":18,"created_at":"2015-12-02T09:05:11Z","updated_at":"2015-12-10T12:07:52Z","closed_at":null,"body":"Hello!\r\n\r\nI have a route which I am requesting to fetch some information that should only be allowed when the user is authenticated and the access_token is provided. To do so, I use the provided middleware as such:\r\n\r\n```php\r\n    // Code in bootstrap.php\r\n    $app->routeMiddleware([\r\n        'oauth' => LucaDegasperi\\OAuth2Server\\Middleware\\OAuthMiddleware::class\r\n    ]);\r\n    \r\n    // Code in routes.php\r\n    $app->get('{id:[0-9]+}/action/follow', [\r\n        'as' => 'user.action.follow',\r\n        'uses' => 'Users\\UserController@getFollowUser',\r\n        'middleware' => 'oauth|validate:users'\r\n    ]);\r\n```\r\n\r\nWhen I use a REST client such as Rested or Paw, any requests to this URL containing the Authorization header yields the following response, which is correct and perfect:\r\n\r\n    HTTP/1.1 401 Unauthorized\r\n    Connection: keep-alive\r\n    Content-Type: application/json\r\n    Server: nginx/1.8.0\r\n    0: HTTP/1.1 401 Unauthorized\r\n    Date: Wed, 02 Dec 2015 08:30:04 GMT\r\n    Cache-Control: no-cache\r\n    Transfer-Encoding: Identity\r\n    \r\n    {\r\n        \"error\": \"access_denied\",\r\n        \"error_description\": \"The resource owner or authorization server denied the request.\"\r\n    }\r\n\r\nBut when the same request is performed through the web browser (Angular $http) I get the same response, but a different status code (500) and the response as HTML, which is not preferable at all: \r\n\r\n<img width=\"988\" alt=\"skarmklipp 2015-12-02 09 57 14\" src=\"https://cloud.githubusercontent.com/assets/4216027/11526667/4bd5b3f6-98dc-11e5-9ff1-1b5480292255.png\">\r\n\r\nIf you can't see the image, visit this page: https://www.dropbox.com/s/4nsi6h4swbmn5jc/Sk%C3%A4rmklipp%202015-12-02%2009.57.14.png?dl=0\r\n\r\nCould anyone explain why it suddenly generates an internal server error, and why it doesn't return it's response with the proper status code and payload as it does from any REST client? As far as I'm aware, this is something that started happening in the most recent update of this library, because I had not seen it occurring before.\r\n\r\nThese are the request headers sent by my REST client:\r\n\r\n    Accept: application/json\r\n    Accept-Encoding: gzip, deflate\r\n    Authorization: Bearer BaUbu9Nj2quK3VR4fizcscxA31Q1mE79iqxV2uc9\r\n    Accept-Language: sv-se\r\n\r\nAnd these are the ones sent by my web browser (Google chrome, but same problem in Firefox)\r\n\r\n    Accept:application/json, text/plain, */*\r\n    Accept-Encoding:gzip, deflate, sdch\r\n    Accept-Language:sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4\r\n    Cache-Control:no-cache\r\n    Connection:keep-alive\r\n    Host:*REMOVED*\r\n    Origin:*REMOVED*\r\n    Pragma:no-cache\r\n    Referer:*REMOVED*\r\n    User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36\r\n\r\nEven when I explicitly set `Accept: application/json` in the web browser, I still get the same results, and funny enough, omitting the same request header in the rest client yields the same results.\r\n\r\nHow can this be?\r\n\r\nThanks in advance,\r\nJonathan"},"comment":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/comments/163592147","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/614#issuecomment-163592147","issue_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/614","id":163592147,"user":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T12:07:52Z","updated_at":"2015-12-10T12:07:52Z","body":"@jonathanlundstrom do you use slack? If so, I can invite you to a Swedish channel for front-end devs."}}