问题
As of today an application that i have keeps getting the following error while using Facebook Login Api.
Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request
Last successfull attempt was yesterday night 2018-08-29 23:40:00 and since then all loging attempts end up to redirect_url mismatch.
My call back url is like
https://mysubdomain.mysite.gr/index.php?r=site/callbackfb
also tried alternative
https://mysubdomain.mysite.gr/index.php/site/callbackfb
but still no success. No change was made to the application and nothing seems to justify the exception. Tried also with latest sdk librady, but i still get the same error.
Any help would be much appreciated.
回答1:
i am facing same issue today here is solution please check below link :.
Facebook PHP SDK - Login helper returns error
I'm currently working on Graph api version v2.2
If you open Enforce HTTPS on in Facebook Login settings.
Go to you facebook-php-sdk and inside that
Facebook\Helpers\FacebookRedirectLoginHelper.php
change $redirectUrl:
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code']);
To
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code','enforce_https']);
回答2:
Facebook seems to have "short of" break its own code. By enabling enfore https, the Validate OAuth url no longer validates.
I have added the following param on my redirect url to bypass the issue
https://mysubdomain.mysite.gr/index.php?r=site/callbackfb&enforce_https=1
回答3:
It is a bug from Facebook that started today.
Go to Facebook Developers. Choose your app. Go to Facebook Login > Settings Then uncheck ENFORCE HTTPS
It worked for me :)
来源:https://stackoverflow.com/questions/52095150/facebook-login-error-validating-verification-code