{"action":"created","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/574","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/574/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/574/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/574/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/574","id":111570632,"number":574,"title":"Call to a member function getSession() on null using dingo/api","user":{"login":"refear99","id":7454701,"avatar_url":"https://avatars.githubusercontent.com/u/7454701?v=3","gravatar_id":"","url":"https://api.github.com/users/refear99","html_url":"https://github.com/refear99","followers_url":"https://api.github.com/users/refear99/followers","following_url":"https://api.github.com/users/refear99/following{/other_user}","gists_url":"https://api.github.com/users/refear99/gists{/gist_id}","starred_url":"https://api.github.com/users/refear99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refear99/subscriptions","organizations_url":"https://api.github.com/users/refear99/orgs","repos_url":"https://api.github.com/users/refear99/repos","events_url":"https://api.github.com/users/refear99/events{/privacy}","received_events_url":"https://api.github.com/users/refear99/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/labels/support","name":"support","color":"fad8c7"}],"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":8,"created_at":"2015-10-15T08:44:52Z","updated_at":"2015-10-21T09:19:46Z","closed_at":null,"body":"Hi guys.\r\n\r\nI am using Laravel 5.1.* And dingo/api 1.0.*@dev\r\n\r\nIn my ServiceProvider:\r\n\r\n```\r\napp('Dingo\\Api\\Auth\\Auth')->extend('oauth', function ($app) {\r\n            $provider = new \\Dingo\\Api\\Auth\\Provider\\OAuth2($app['oauth2-server.authorizer']->getChecker());\r\n\r\n            $provider->setUserResolver(function ($id) {\r\n                return \\App\\Models\\User::find($id);\r\n            });\r\n\r\n            return $provider;\r\n        });\r\n```\r\n\r\nroutes.php\r\n\r\n```\r\nApiRoute::group(['middleware' => 'oauth'], function () {\r\n    ApiRoute::post('auth/access_token', 'AuthController@postAccessToken');\r\n});\r\n```\r\n\r\nKernel.php\r\n\r\n```\r\nprotected $routeMiddleware = [\r\n        /*\r\n         * Oauth2\r\n         */\r\n        'oauth'                      => \\LucaDegasperi\\OAuth2Server\\Middleware\\OAuthMiddleware::class,\r\n        'oauth-user'                 => \\LucaDegasperi\\OAuth2Server\\Middleware\\OAuthUserOwnerMiddleware::class,\r\n        'oauth-client'               => \\LucaDegasperi\\OAuth2Server\\Middleware\\OAuthClientOwnerMiddleware::class,\r\n        'check-authorization-params' => \\LucaDegasperi\\OAuth2Server\\Middleware\\CheckAuthCodeRequestMiddleware::class,\r\n    ];\r\n```\r\n\r\nI am using `refresh_token` Grant to get new access_token;  \r\n\r\n```\r\n{\r\n  \"grant_type\": \"refresh_token\",\r\n  \"client_id\": \"1\",\r\n  \"client_secret\": \"OyzSVM1CZcvX0il9LBwN801lgWHuXsFf\",\r\n  \"refresh_token\": \"Tak60sV1mGVSO0oq43TjpxI1zOYuH7wByWrNI2GQ\"\r\n}\r\n```\r\n\r\nThe issue is sometimes it's throw an Exception like this:\r\n\r\n```\r\nCall to a member function getSession() on null\r\n```\r\n\r\nvendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php\r\n\r\n```\r\n$oldAccessToken = $oldRefreshToken->getAccessToken();\r\n\r\n$session = $oldAccessToken->getSession(); //this line throw exception\r\n$scopes = $this->formatScopes($session->getScopes());\r\n\r\n$requestedScopesString = $this->server->getRequest()->request->get('scope', '');\r\n$requestedScopes = $this->validateScopes($requestedScopesString, $client);\r\n```"},"comment":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/comments/149832085","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/574#issuecomment-149832085","issue_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/574","id":149832085,"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-10-21T09:19:46Z","updated_at":"2015-10-21T09:19:46Z","body":"Could you show me your callback as well?"}}