0

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!

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Well I believe the redirect_uri is used as a hash so it must be submitted in exactly the same form as you provided to the authorize endpoint. The user is redirected to this uri with an extra parameter, code, so it should be sufficient to just remove the code parameter from the current URL. Ensure the encoding is the same (including casing). From your example above it should be "my.domain.com/process.php?param1=value1&param2=value2" encoded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.