{"action":"created","issue":{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/2","labels_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/2/comments","events_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/2/events","html_url":"https://github.com/tuupola/slim-jwt-auth/issues/2","id":74974594,"number":2,"title":"Return of Data","user":{"login":"alfw","id":2608282,"avatar_url":"https://avatars.githubusercontent.com/u/2608282?v=3","gravatar_id":"","url":"https://api.github.com/users/alfw","html_url":"https://github.com/alfw","followers_url":"https://api.github.com/users/alfw/followers","following_url":"https://api.github.com/users/alfw/following{/other_user}","gists_url":"https://api.github.com/users/alfw/gists{/gist_id}","starred_url":"https://api.github.com/users/alfw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfw/subscriptions","organizations_url":"https://api.github.com/users/alfw/orgs","repos_url":"https://api.github.com/users/alfw/repos","events_url":"https://api.github.com/users/alfw/events{/privacy}","received_events_url":"https://api.github.com/users/alfw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/labels/suggestion","name":"suggestion","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-10T18:34:07Z","updated_at":"2015-05-15T18:17:30Z","closed_at":null,"body":"Hello,\r\n\r\nIm working with a restful api where i plan to use this lib in. But i have some challanges whiout hevey changes of your code. When you do your checks for the tokens and they are not valid, you just return the response code and no more data.\r\n\r\nIs ther a way you cold add in support for return of data in the checks? Like a array input in the code with default data you want, then you can ether set a standar output message or allow it to be set when you open the Middleware?"},"comment":{"url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/comments/102477423","html_url":"https://github.com/tuupola/slim-jwt-auth/issues/2#issuecomment-102477423","issue_url":"https://api.github.com/repos/tuupola/slim-jwt-auth/issues/2","id":102477423,"user":{"login":"tuupola","id":21913,"avatar_url":"https://avatars.githubusercontent.com/u/21913?v=3","gravatar_id":"","url":"https://api.github.com/users/tuupola","html_url":"https://github.com/tuupola","followers_url":"https://api.github.com/users/tuupola/followers","following_url":"https://api.github.com/users/tuupola/following{/other_user}","gists_url":"https://api.github.com/users/tuupola/gists{/gist_id}","starred_url":"https://api.github.com/users/tuupola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuupola/subscriptions","organizations_url":"https://api.github.com/users/tuupola/orgs","repos_url":"https://api.github.com/users/tuupola/repos","events_url":"https://api.github.com/users/tuupola/events{/privacy}","received_events_url":"https://api.github.com/users/tuupola/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T18:17:30Z","updated_at":"2015-05-15T18:17:30Z","body":"Last commit in master adds an optional error handler. It is called in cases like when decoding the token fails or token is not found. For example code below.\r\n\r\n```php\r\n$app->add(new JwtAuthentication([\r\n    \"secret\" => \"here be dragons...\",\r\n    \"error\" => function ($arguments) use ($app) {\r\n        $response[\"status\"] = \"error\";\r\n        $response[\"message\"] = $arguments[\"message\"];\r\n        $app->response->header(\"Content-Type\", \"application/json\");\r\n        $app->response->write(json_encode($response, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));\r\n    }\r\n]));\r\n```\r\n\r\nIf token is missing, it would output.\r\n\r\n```\r\nHTTP/1.1 401 Unauthorized\r\nContent-Type: application/json\r\n\r\n{\r\n    \"status\": \"error\",\r\n    \"message\": \"Token not found\"\r\n}\r\n```\r\n\r\nI am still playing around with this so things might change."}}