facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.96k forks source link

www causes Facebook SDK returned an error: Cross-site request forgery validation failed. Required param "state" missing from persistent data. #1134

Closed JustinReinhart closed 5 years ago

JustinReinhart commented 5 years ago

Update: I noticed my handheld was adding www to the initial page and that was causing the issue.

Hi I've seen this error reported many times but people always speak of it as being a global problem. I however am experiencing it only on Chrome browser for iOS but not on my PC.

Facebook SDK returned an error: Cross-site request forgery validation failed. Required param "state" missing from persistent data.

I can use Chrome on my PC fine, including using an incognito window just fine. I can use Safari for iOS just fine. Only Chrome for iOS has the issue. I am not sure I understand the problem because I assume it should be broken everywhere, not just in one browser. session_start() is called at the beginning of every script; The login script, the callback script, etc. I am not using any specialized login frameworks. And again, it works everywhere else just fine.

JustinReinhart commented 5 years ago

Aha. On my handheld it had appended www to the beginning of the url and was causing forgery on the return trip. I'll just use htaccess to enforce no www ever.