{"action":"created","issue":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/831","repository_url":"https://api.github.com/repos/tymondesigns/jwt-auth","labels_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/831/labels{/name}","comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/831/comments","events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/831/events","html_url":"https://github.com/tymondesigns/jwt-auth/issues/831","id":172039804,"number":831,"title":"how to refresh a token ? The token has been blacklisted ?","user":{"login":"leepin","id":9162521,"avatar_url":"https://avatars.githubusercontent.com/u/9162521?v=3","gravatar_id":"","url":"https://api.github.com/users/leepin","html_url":"https://github.com/leepin","followers_url":"https://api.github.com/users/leepin/followers","following_url":"https://api.github.com/users/leepin/following{/other_user}","gists_url":"https://api.github.com/users/leepin/gists{/gist_id}","starred_url":"https://api.github.com/users/leepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leepin/subscriptions","organizations_url":"https://api.github.com/users/leepin/orgs","repos_url":"https://api.github.com/users/leepin/repos","events_url":"https://api.github.com/users/leepin/events{/privacy}","received_events_url":"https://api.github.com/users/leepin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-19T02:04:55Z","updated_at":"2016-10-05T23:29:07Z","closed_at":"2016-08-22T04:22:14Z","body":"Hello , I use Lumen framework (Version 5.2 , JWT version 1.0 )\r\n\r\nI get a token , but i can't refresh it , the system tell me \"The token has been blacklisted\". \r\n\r\nI am sorry,my english is very bad. \r\n\r\nthanks for your help.\r\n\r\nRoute:\r\n```php\r\n$app->group(['prefix' => 'auth', 'namespace' => '\\App\\Http\\Controllers'], function () use ($app) {\r\n\t\r\n\t$app->post('/signin', 'AuthController@signin');\r\n\t$app->put('/refresh', ['middleware' => ['before' => 'jwt.auth', 'after' => 'jwt.refresh'], 'uses' => 'AuthController@refresh']);\r\n\t\r\n});\r\n```\r\n\r\nSign in \r\n```PHP\r\npublic function signin(Request $request)\r\n\t{\r\n\t\t$this->validate($request, [\r\n\t\t\t'email'    => 'required|email|max:255',\r\n\t\t\t'password' => 'required'\r\n\t\t]);\r\n\t\t\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\tif ($token = $this->jwt->attempt($request->only(['email', 'password']))) {\r\n\t\t\t\treturn $this->json([\r\n\t\t\t\t\t'token' => $token\r\n\t\t\t\t]);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $this->json([], 403, $this->_lang['signin_incorrect']);\r\n\t\t\t\r\n\t\t} catch (JWTException $e) {\r\n\t\t\treturn $this->json([], 500, $e->getMessage());\r\n\t\t}\r\n\t\t\r\n\t}\r\n```\r\n\r\nrefresh:\r\n\r\n```php\r\npublic function refresh()\r\n\t{\r\n\t\t\r\n\t\ttry {\r\n\t\t\t$this->jwt->setToken($this->jwt->getToken());\r\n\t\t\t\r\n\t\t\tif($this->jwt->invalidate()) {\r\n\t\t\t\treturn $this->json([\r\n\t\t\t\t\t'token' => $this->jwt->refresh()\r\n\t\t\t\t]);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $this->json([], 403, $this->_lang['token_incorrect']);\r\n\t\t\t\r\n\t\t\t\r\n\t\t} catch (JWTException $e) {\r\n\t\t\treturn $this->json([], 500, $e->getMessage());\r\n\t\t}\r\n\t}\r\n```\r\nAuth Service Provider\r\n```php\r\npublic function boot()\r\n    {\r\n        // Here you may define how you wish users to be authenticated for your Lumen\r\n        // application. The callback which receives the incoming request instance\r\n        // should return either a User instance or null. You're free to obtain\r\n        // the User instance via an API token or any other method necessary.\r\n\t\r\n\t\t$this->app['auth']->viaRequest('api', function ($request)\r\n\t\t{\r\n\t\t\treturn \\App\\Models\\User::where('email', $request->input('email'))->first();\r\n\t\t});\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/comments/251828811","html_url":"https://github.com/tymondesigns/jwt-auth/issues/831#issuecomment-251828811","issue_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/831","id":251828811,"user":{"login":"mtpultz","id":599498,"avatar_url":"https://avatars.githubusercontent.com/u/599498?v=3","gravatar_id":"","url":"https://api.github.com/users/mtpultz","html_url":"https://github.com/mtpultz","followers_url":"https://api.github.com/users/mtpultz/followers","following_url":"https://api.github.com/users/mtpultz/following{/other_user}","gists_url":"https://api.github.com/users/mtpultz/gists{/gist_id}","starred_url":"https://api.github.com/users/mtpultz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtpultz/subscriptions","organizations_url":"https://api.github.com/users/mtpultz/orgs","repos_url":"https://api.github.com/users/mtpultz/repos","events_url":"https://api.github.com/users/mtpultz/events{/privacy}","received_events_url":"https://api.github.com/users/mtpultz/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T23:29:07Z","updated_at":"2016-10-05T23:29:07Z","body":"@leepin I'd also be interested to know what you did with the JWT Manager if you have time."}}
{"actor":{"display_login":"mtpultz"}}