I had a similar issue last week, and tracked it down to the state
field being overwritten by multiple calls to getLoginUrl()
. Each time you call getLoginUrl()
, a new state
token is generated in the SDK and stored in the $_SESSION
(it's just a random value), so if you call it twice and the user uses the first link to log in, the second call will have reset the SDK's internal state
token, and you will get this error in your logs.
The SDK looks for the same state
token in the URL coming back after Facebook authorizes the user and redirects them back to your site, and if it doesn't match it will log this error (here's a link to the source).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…