{"action":"created","issue":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/513","repository_url":"https://api.github.com/repos/tymondesigns/jwt-auth","labels_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/513/labels{/name}","comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/513/comments","events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/513/events","html_url":"https://github.com/tymondesigns/jwt-auth/issues/513","id":133847334,"number":513,"title":"Feature: Laravel 5.2 Custom Authentication Guard and Driver","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-02-16T00:07:59Z","updated_at":"2016-05-04T00:54:17Z","closed_at":null,"body":"The docs indicate it is possible to create your own implementation of Illuminate\\Contracts\\Auth\\Guard and registering it as a driver in a service provider.  \r\n\r\nI was reading about the new stateless token authentication that was added in 5.2 in a [JacobBennett Gist](https://gistlog.co/JacobBennett/090369fbab0b31130b51) (the docs are really vague), but it doesn't appear to be the same as JWT tokens.  That said it would be amazing to be able to leverage Laravel's API the same way.\r\n\r\nWould it be possible to create a custom driver to reduce the amount of changes required to implement JWT tokens, and reduce the API a bit so using more of Laravel's API?  For example getting a user is `Auth::guard('api')->user();` using the API guard, and the equivalent could be `Auth::guard('jwt')->user();`"},"comment":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/comments/216712264","html_url":"https://github.com/tymondesigns/jwt-auth/issues/513#issuecomment-216712264","issue_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/513","id":216712264,"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-05-04T00:54:17Z","updated_at":"2016-05-04T00:54:17Z","body":"@HlaingTinHtun and @ghprod,\r\n\r\nLogout\r\n=====\r\n\r\n```\r\n/**\r\n * Log the user out of the application.\r\n *\r\n * @return \\Illuminate\\Http\\Response\r\n */\r\npublic function logout()\r\n{\r\n    Auth::guard($this->getGuard())->logout();\r\n\r\n    // ...\r\n}\r\n```\r\n\r\nThis invokes JWTGuard's logout method, which invalidates the token, resets the user, and unsets the token.\r\n\r\nJWTGuard's Logout\r\n-----\r\n\r\n```\r\n/**\r\n * Logout the user, thus invalidating the token.\r\n *\r\n * @param  bool  $forceForever\r\n *\r\n * @return void\r\n */\r\npublic function logout($forceForever = false)\r\n{\r\n    $this->requireToken()->invalidate($forceForever);\r\n\r\n    $this->user = null;\r\n    $this->jwt->unsetToken();\r\n}\r\n```"}}