{"action":"created","issue":{"url":"https://api.github.com/repos/dingo/api/issues/982","repository_url":"https://api.github.com/repos/dingo/api","labels_url":"https://api.github.com/repos/dingo/api/issues/982/labels{/name}","comments_url":"https://api.github.com/repos/dingo/api/issues/982/comments","events_url":"https://api.github.com/repos/dingo/api/issues/982/events","html_url":"https://github.com/dingo/api/issues/982","id":147697690,"number":982,"title":"Oauth2 broken with latest Dingo","user":{"login":"ngroot","id":1029199,"avatar_url":"https://avatars.githubusercontent.com/u/1029199?v=3","gravatar_id":"","url":"https://api.github.com/users/ngroot","html_url":"https://github.com/ngroot","followers_url":"https://api.github.com/users/ngroot/followers","following_url":"https://api.github.com/users/ngroot/following{/other_user}","gists_url":"https://api.github.com/users/ngroot/gists{/gist_id}","starred_url":"https://api.github.com/users/ngroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngroot/subscriptions","organizations_url":"https://api.github.com/users/ngroot/orgs","repos_url":"https://api.github.com/users/ngroot/repos","events_url":"https://api.github.com/users/ngroot/events{/privacy}","received_events_url":"https://api.github.com/users/ngroot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-04-12T09:57:49Z","updated_at":"2016-05-06T13:11:37Z","closed_at":null,"body":"I've been running the oauth2 server from https://github.com/lucadegasperi/oauth2-server-laravel version 5.1.4 using the dev-master version of dingo/api.\r\n\r\nLately I ran in a problem in my api it could not get the access token anymore during the request. The complete error from the oauth2 package was:\r\n\r\n`NoActiveAccessTokenException Authorizer.php line 104 Tried to access session data without an active access token`\r\n\r\nI narrowed it done to be an issue in an update of the dingo/api package. Rolling back to the 1.0.0-beta3 tag solved the problem.\r\n\r\nI could not find why this is happening but it looks like route middlewares do not work anymore."},"comment":{"url":"https://api.github.com/repos/dingo/api/issues/comments/217435697","html_url":"https://github.com/dingo/api/issues/982#issuecomment-217435697","issue_url":"https://api.github.com/repos/dingo/api/issues/982","id":217435697,"user":{"login":"lukasoppermann","id":813754,"avatar_url":"https://avatars.githubusercontent.com/u/813754?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasoppermann","html_url":"https://github.com/lukasoppermann","followers_url":"https://api.github.com/users/lukasoppermann/followers","following_url":"https://api.github.com/users/lukasoppermann/following{/other_user}","gists_url":"https://api.github.com/users/lukasoppermann/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasoppermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasoppermann/subscriptions","organizations_url":"https://api.github.com/users/lukasoppermann/orgs","repos_url":"https://api.github.com/users/lukasoppermann/repos","events_url":"https://api.github.com/users/lukasoppermann/events{/privacy}","received_events_url":"https://api.github.com/users/lukasoppermann/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T13:11:37Z","updated_at":"2016-05-06T13:11:37Z","body":"Well I have build a Request class which has an authorize method. You need to call the `validateAccessToken` before you actually need the session, e.g. before you try hasScope. \r\n\r\n```php\r\n$authorizer = app('oauth2-server.authorizer');\r\n$authorizer->validateAccessToken();\r\n\r\nif(!app('oauth2-server.authorizer')->hasScope('client.read')){\r\n    return false;\r\n}\r\n```\r\n\r\nI think the `api.auth` middleware does the same, and for the the scopes in the _route group_ worked fine, however it seems the auth middleware somehow deletes the session afterwards or the session is restricted to inside the middleware so that you can not get it outside. Is this true @jasonlewis?"}}