{"action":"created","issue":{"url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/432","repository_url":"https://api.github.com/repos/skipperbent/simple-php-router","labels_url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/432/labels{/name}","comments_url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/432/comments","events_url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/432/events","html_url":"https://github.com/skipperbent/simple-php-router/issues/432","id":381997389,"node_id":"MDU6SXNzdWUzODE5OTczODk=","number":432,"title":"BaseCsrfVerifier expects the field name to be \"csrf-token\"","user":{"login":"NateNjuguna","id":15225569,"node_id":"MDQ6VXNlcjE1MjI1NTY5","avatar_url":"https://avatars1.githubusercontent.com/u/15225569?v=4","gravatar_id":"","url":"https://api.github.com/users/NateNjuguna","html_url":"https://github.com/NateNjuguna","followers_url":"https://api.github.com/users/NateNjuguna/followers","following_url":"https://api.github.com/users/NateNjuguna/following{/other_user}","gists_url":"https://api.github.com/users/NateNjuguna/gists{/gist_id}","starred_url":"https://api.github.com/users/NateNjuguna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NateNjuguna/subscriptions","organizations_url":"https://api.github.com/users/NateNjuguna/orgs","repos_url":"https://api.github.com/users/NateNjuguna/repos","events_url":"https://api.github.com/users/NateNjuguna/events{/privacy}","received_events_url":"https://api.github.com/users/NateNjuguna/received_events","type":"User","site_admin":false},"labels":[{"id":262177751,"node_id":"MDU6TGFiZWwyNjIxNzc3NTE=","url":"https://api.github.com/repos/skipperbent/simple-php-router/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-18T20:34:14Z","updated_at":"2018-11-24T23:49:22Z","closed_at":"2018-11-24T23:49:22Z","author_association":"NONE","body":"### Description\r\n\r\nThe library fails to verify a csrf token in any submitted form on any route. The field is submitted as **\"csrf_token\"** as said in the docs [here](https://github.com/skipperbent/simple-php-router/#getting-csrf-token):\r\n\r\n> The default name/key for the input-field is csrf_token and is defined in the POST_KEY constant in the BaseCsrfVerifier class.\r\n\r\n but a TokenMistmatchException is thrown. However changing to ***\"csrf-token\"*** solves the issue as the BaseCsrfVerifier middlware expects this instead as shown in the snippet below:\r\n```php\r\n...\r\nclass BaseCsrfVerifier implements IMiddleware\r\n{\r\n    const POST_KEY = 'csrf-token';\r\n...\r\n```\r\n\r\n### Steps to reproduce the error\r\n\r\n1. Add the following csrf verifier:\r\n\r\n```php\r\n...\r\nuse Pecee\\Http\\Middleware\\BaseCsrfVerifier;\r\n...\r\nSimpleRouter::csrfVerifier(new BaseCsrfVerifier());\r\n...\r\n```\r\n\r\n2. Submit a form with a csrf token as *csrf_verifier* to `/login` in browser.\r\n\r\n3. `TokenMismatchException` is thrown by library.\r\n\r\n### Route and/or callback for failing route\r\n\r\n*Route:*\r\n\r\n```php\r\nSimpleRouter::post('/login', 'Auth@postLogin');\r\n```\r\n\r\n*Callback:*\r\n\r\n```php\r\npublic function postLogin() {\r\n    echo 'Fine';\r\n}\r\n```\r\n\r\n### Debug info\r\n\r\n```php\r\n\r\nN/A\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/comments/441404297","html_url":"https://github.com/skipperbent/simple-php-router/issues/432#issuecomment-441404297","issue_url":"https://api.github.com/repos/skipperbent/simple-php-router/issues/432","id":441404297,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTQwNDI5Nw==","user":{"login":"skipperbent","id":634762,"node_id":"MDQ6VXNlcjYzNDc2Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/634762?v=4","gravatar_id":"","url":"https://api.github.com/users/skipperbent","html_url":"https://github.com/skipperbent","followers_url":"https://api.github.com/users/skipperbent/followers","following_url":"https://api.github.com/users/skipperbent/following{/other_user}","gists_url":"https://api.github.com/users/skipperbent/gists{/gist_id}","starred_url":"https://api.github.com/users/skipperbent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skipperbent/subscriptions","organizations_url":"https://api.github.com/users/skipperbent/orgs","repos_url":"https://api.github.com/users/skipperbent/repos","events_url":"https://api.github.com/users/skipperbent/events{/privacy}","received_events_url":"https://api.github.com/users/skipperbent/received_events","type":"User","site_admin":false},"created_at":"2018-11-24T23:49:22Z","updated_at":"2018-11-24T23:49:22Z","author_association":"OWNER","body":"The fix is available in version 4.2.0.6.\r\n\r\n/ Simon"}}
{"actor":{"display_login":"skipperbent"}}