Eugeny89
Eugeny89

Reputation: 3731

php + facebook. geting access token returns: Error validating verification code

After a user is redirected to login dialog

$url = "https://graph.facebook.com/oauth/authorize?client_id=$appid&scope=&" .
"redirect_uri=$process_url";

where $process_uri is urlencoded url of form https://my.domain.com/process.php?param1=value1&param2=value2. After user returned to https://my.domain.com/process.php I do curl request to (have tried to use file_get_contents first):

$url = "https://graph.facebook.com/oauth/access_token?client_id=" .
"$appid&redirect_uri=$current_url&client_secret=$secret" .
"&code={$_REQUEST['code']}";

I'm getting { "error": { "message": "Error validating verification code.", "type": "OAuthException", "code": 100 } }.

After googling I realized that the main reason that may cause the problem is wrong redirect_uri in curl request. The question is: what should be redirect_uri in curl request? https://my.domain.com/? Or https://my.domain.com/process.php? Or https://my.domain.com/process.php?param1=value1&param2=value2?

Thank you in advance!

Upvotes: 0

Views: 432

Answers (1)

darnmason
darnmason

Reputation: 2732

Remove the code parameter when you're submitting the current URL as the redirect_uri to the https://graph.facebook.com/oauth/access_token endpoint.

Upvotes: 1

Related Questions