{"action":"created","issue":{"url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/11","repository_url":"https://api.github.com/repos/koltyakov/sp-rest-proxy","labels_url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/11/comments","events_url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/11/events","html_url":"https://github.com/koltyakov/sp-rest-proxy/issues/11","id":208252353,"number":11,"title":"POST Requests Throwing 403 Error","user":{"login":"ATrien","id":489945,"avatar_url":"https://avatars.githubusercontent.com/u/489945?v=3","gravatar_id":"","url":"https://api.github.com/users/ATrien","html_url":"https://github.com/ATrien","followers_url":"https://api.github.com/users/ATrien/followers","following_url":"https://api.github.com/users/ATrien/following{/other_user}","gists_url":"https://api.github.com/users/ATrien/gists{/gist_id}","starred_url":"https://api.github.com/users/ATrien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ATrien/subscriptions","organizations_url":"https://api.github.com/users/ATrien/orgs","repos_url":"https://api.github.com/users/ATrien/repos","events_url":"https://api.github.com/users/ATrien/events{/privacy}","received_events_url":"https://api.github.com/users/ATrien/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"koltyakov","id":7816483,"avatar_url":"https://avatars.githubusercontent.com/u/7816483?v=3","gravatar_id":"","url":"https://api.github.com/users/koltyakov","html_url":"https://github.com/koltyakov","followers_url":"https://api.github.com/users/koltyakov/followers","following_url":"https://api.github.com/users/koltyakov/following{/other_user}","gists_url":"https://api.github.com/users/koltyakov/gists{/gist_id}","starred_url":"https://api.github.com/users/koltyakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koltyakov/subscriptions","organizations_url":"https://api.github.com/users/koltyakov/orgs","repos_url":"https://api.github.com/users/koltyakov/repos","events_url":"https://api.github.com/users/koltyakov/events{/privacy}","received_events_url":"https://api.github.com/users/koltyakov/received_events","type":"User","site_admin":false},"assignees":[{"login":"koltyakov","id":7816483,"avatar_url":"https://avatars.githubusercontent.com/u/7816483?v=3","gravatar_id":"","url":"https://api.github.com/users/koltyakov","html_url":"https://github.com/koltyakov","followers_url":"https://api.github.com/users/koltyakov/followers","following_url":"https://api.github.com/users/koltyakov/following{/other_user}","gists_url":"https://api.github.com/users/koltyakov/gists{/gist_id}","starred_url":"https://api.github.com/users/koltyakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koltyakov/subscriptions","organizations_url":"https://api.github.com/users/koltyakov/orgs","repos_url":"https://api.github.com/users/koltyakov/repos","events_url":"https://api.github.com/users/koltyakov/events{/privacy}","received_events_url":"https://api.github.com/users/koltyakov/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2017-02-16T21:29:37Z","updated_at":"2017-02-17T21:21:22Z","closed_at":null,"body":"The proxy works great for GET reqeusts.  However, when I try to do a POST request to insert a SharePoint list item I receive the following error:\r\n\r\nStatus Code: 403 Forbidden\r\n\"The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.\"\r\n\r\nI have researched this error and followed suggestions around setting the X-RequestDigest property in the header.  Setting X-RequestDigest to a new digest does not solve the issue.\r\n\r\nHas anyone been able to get sp-rest-proxy to work for POST requests?"},"comment":{"url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/comments/280769732","html_url":"https://github.com/koltyakov/sp-rest-proxy/issues/11#issuecomment-280769732","issue_url":"https://api.github.com/repos/koltyakov/sp-rest-proxy/issues/11","id":280769732,"user":{"login":"koltyakov","id":7816483,"avatar_url":"https://avatars.githubusercontent.com/u/7816483?v=3","gravatar_id":"","url":"https://api.github.com/users/koltyakov","html_url":"https://github.com/koltyakov","followers_url":"https://api.github.com/users/koltyakov/followers","following_url":"https://api.github.com/users/koltyakov/following{/other_user}","gists_url":"https://api.github.com/users/koltyakov/gists{/gist_id}","starred_url":"https://api.github.com/users/koltyakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koltyakov/subscriptions","organizations_url":"https://api.github.com/users/koltyakov/orgs","repos_url":"https://api.github.com/users/koltyakov/repos","events_url":"https://api.github.com/users/koltyakov/events{/privacy}","received_events_url":"https://api.github.com/users/koltyakov/received_events","type":"User","site_admin":false},"created_at":"2017-02-17T21:21:22Z","updated_at":"2017-02-17T21:21:22Z","body":"Today is definitely not my day =(\r\n\r\nCould you try to:\r\n\r\n1)\r\n\r\n- take ./config/_private.conf.json\r\n- copy password hash value (UPD: I'm not sure that there will be a hash password there though since the update)\r\n- replace it with raw password\r\n- try request in action\r\n\r\n2)\r\n\r\n- execute this code in a Node.js console:\r\n\r\n```javascript\r\nvar cpass = new (require('cpass'));\r\nconsole.log(cpass.decode('_password_hash_from_private_config_'));\r\n```\r\n\r\n- will you see your password in output?\r\n\r\nNotes:\r\n\r\n- In a relative path only the relative /_api/web/so_on uri should be used\r\n- Proxy takes relative uri and concatenate them with context.siteUrl from config\r\n\r\n- On non-working machine, I can't reproduce access denied error since 1.1.12 anymore\r\n\r\nIf nothing helps then going one level deeper:\r\n\r\n- Put the script in a `test.js` file \r\n- Change values in config object\r\n- and run `node /test`\r\n\r\n```javascript\r\nvar config = {\r\n  \"siteUrl\": \"http://server/sites/site\",\r\n  \"username\": \"user.name\",\r\n  \"password\": \"raw_password\",\r\n  \"domain\": \"domain_name\"\r\n};\r\n\r\nvar request = require('sp-request').create(config);\r\n\r\nrequest.get(config.siteUrl + '/_api/web')\r\n    .then(function(response) {\r\n        console.log('Get is OK');\r\n    })\r\n    .catch(function (err) {\r\n        console.log('Get failed');\r\n    });\r\n\r\nrequest.requestDigest(config.siteUrl)\r\n    .then(function(digest) {\r\n        console.log('Digest received', digest);\r\n    })\r\n    .catch(function(err) {\r\n        console.log('Digest failed');\r\n    });\r\n```"}}
{"actor":{"display_login":"koltyakov"}}