{"action":"created","issue":{"url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/62","repository_url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension","labels_url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/62/comments","events_url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/62/events","html_url":"https://github.com/laracasts/Behat-Laravel-Extension/issues/62","id":191679841,"number":62,"title":"CSRF token empty when using this extension","user":{"login":"Harrisonbro","id":377366,"avatar_url":"https://avatars.githubusercontent.com/u/377366?v=3","gravatar_id":"","url":"https://api.github.com/users/Harrisonbro","html_url":"https://github.com/Harrisonbro","followers_url":"https://api.github.com/users/Harrisonbro/followers","following_url":"https://api.github.com/users/Harrisonbro/following{/other_user}","gists_url":"https://api.github.com/users/Harrisonbro/gists{/gist_id}","starred_url":"https://api.github.com/users/Harrisonbro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harrisonbro/subscriptions","organizations_url":"https://api.github.com/users/Harrisonbro/orgs","repos_url":"https://api.github.com/users/Harrisonbro/repos","events_url":"https://api.github.com/users/Harrisonbro/events{/privacy}","received_events_url":"https://api.github.com/users/Harrisonbro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"alnutile","id":365385,"avatar_url":"https://avatars.githubusercontent.com/u/365385?v=3","gravatar_id":"","url":"https://api.github.com/users/alnutile","html_url":"https://github.com/alnutile","followers_url":"https://api.github.com/users/alnutile/followers","following_url":"https://api.github.com/users/alnutile/following{/other_user}","gists_url":"https://api.github.com/users/alnutile/gists{/gist_id}","starred_url":"https://api.github.com/users/alnutile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alnutile/subscriptions","organizations_url":"https://api.github.com/users/alnutile/orgs","repos_url":"https://api.github.com/users/alnutile/repos","events_url":"https://api.github.com/users/alnutile/events{/privacy}","received_events_url":"https://api.github.com/users/alnutile/received_events","type":"User","site_admin":false},"assignees":[{"login":"alnutile","id":365385,"avatar_url":"https://avatars.githubusercontent.com/u/365385?v=3","gravatar_id":"","url":"https://api.github.com/users/alnutile","html_url":"https://github.com/alnutile","followers_url":"https://api.github.com/users/alnutile/followers","following_url":"https://api.github.com/users/alnutile/following{/other_user}","gists_url":"https://api.github.com/users/alnutile/gists{/gist_id}","starred_url":"https://api.github.com/users/alnutile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alnutile/subscriptions","organizations_url":"https://api.github.com/users/alnutile/orgs","repos_url":"https://api.github.com/users/alnutile/repos","events_url":"https://api.github.com/users/alnutile/events{/privacy}","received_events_url":"https://api.github.com/users/alnutile/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-11-25T11:17:15Z","updated_at":"2016-12-11T12:58:12Z","closed_at":null,"body":"We're trying to use this extension to test our application but are finding that then CRSF tokens put into forms with `csrf_field ()` are empty. When using the application normally through a web browser the tokens are included in the form and work correctly. However, when running a Behat test and dumping the page output I can see that we just get `<input name=\"_token\" type=\"hidden\">` (i.e. it contains no value).\r\n\r\nIn my attempts to debug it does seem that a token is getting generated since `Illuminate\\Session\\Store::regenerateToken()` is being called. However, it seems that the session store object that first generates the CSRF token and the one that is subsequently asked for it in the form as different objects — see output below from a `var_dump` in both `Collective\\Html\\FormBuilder::token()` (which we're using to build our forms) and `Illuminate\\Session\\Store::regenerateToken()`. You can see that the `spl_object_hash` values are different so I can only assume that the token is getting lost between the two instances of `Illuminate\\Session\\Store`.\r\n\r\nHow are CSRF tokens supposed to be stored? If it's in the Laravel session, should this extension be able to cope with that and use a persistent session? If not, is there anything obvious that I need to change.\r\n\r\n```\r\narray(4) {\r\n  [0]=>\r\n  string(51) \"★★★ Illuminate\\Session\\Store::regenerateToken\"\r\n  [\"session class\"]=>\r\n  string(24) \"Illuminate\\Session\\Store\"\r\n  [\"spl_object_hash\"]=>\r\n  string(32) \"000000001223f2a1000000001315d23b\"\r\n  [\"current result of Illuminate\\Session\\Store::getToken()\"]=>\r\n  string(40) \"1mRtRhUV3ZZifXHIZmzxYIqFrzDzqDyHqnsyZPEl\"\r\n}\r\n```\r\n\r\n```\r\narray(4) {\r\n  [0]=>\r\n  string(44) \"★★★ Collective\\Html\\FormBuilder::token\"\r\n  [\"session class\"]=>\r\n  string(24) \"Illuminate\\Session\\Store\"\r\n  [\"session object hash\"]=>\r\n  string(32) \"000000001223f215000000001315d23b\"\r\n  [\"current result of Illuminate\\Session\\Store::getToken()\"]=>\r\n  NULL\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/comments/266280655","html_url":"https://github.com/laracasts/Behat-Laravel-Extension/issues/62#issuecomment-266280655","issue_url":"https://api.github.com/repos/laracasts/Behat-Laravel-Extension/issues/62","id":266280655,"user":{"login":"alnutile","id":365385,"avatar_url":"https://avatars.githubusercontent.com/u/365385?v=3","gravatar_id":"","url":"https://api.github.com/users/alnutile","html_url":"https://github.com/alnutile","followers_url":"https://api.github.com/users/alnutile/followers","following_url":"https://api.github.com/users/alnutile/following{/other_user}","gists_url":"https://api.github.com/users/alnutile/gists{/gist_id}","starred_url":"https://api.github.com/users/alnutile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alnutile/subscriptions","organizations_url":"https://api.github.com/users/alnutile/orgs","repos_url":"https://api.github.com/users/alnutile/repos","events_url":"https://api.github.com/users/alnutile/events{/privacy}","received_events_url":"https://api.github.com/users/alnutile/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T12:58:12Z","updated_at":"2016-12-11T12:58:12Z","body":"16 days later @Harrisonbro sorry for the delay.\r\n\r\nI tried a few scenarios to get a sense of the error.\r\n\r\nHere are the 4 results \r\n\r\ncsrf token before and after a form entry with the `@javascript` tag\r\n\r\nhttps://github.com/alnutile/recipes/blob/master/tests/fixtures/login_page_javascript_before_fail.txt\r\n\r\nhttps://github.com/alnutile/recipes/blob/master/tests/fixtures/login_page_javascript_after_fail.txt\r\n\r\n\r\nand now with no `@javascript` tag\r\n\r\nhttps://github.com/alnutile/recipes/blob/master/tests/fixtures/login_page_no_javascript_before_fail.txt\r\n\r\nhttps://github.com/alnutile/recipes/blob/master/tests/fixtures/login_page_no_javascript_after_fail.txt\r\n\r\n\r\nBoth have the `<input name=\"_token\" type=\"hidden\">` as expected.\r\n\r\nI just happen to use the Login form since it is doing a POST `features/bootstrap/LoginTrait.php:9`\r\n\r\nBUT maybe I am not fully understanding the goal or the issue?\r\n\r\n\r\n"}}
{"actor":{"display_login":"alnutile"}}