“Invalid verification code format.” facebook oauth error

Hi I am a beginner to Facebook app development. I am stuck with an authentication issue, I am trying to use this url:

https://graph.facebook.com/oauth/access_token?client_id=$client_id&client_secret=$client_secret&type=client_credentials&redirect_uri=http://www.wesbite.com/facebook/&scope=email,offline_access

but I receive this error: "Invalid verification code format."

I have been trying to solve it for the last three hours and no result. I try to google this message but apparently it is not that popular.

can you please help?

Edit: I use this function:

function get_contents($link)
{
if (function_exists('curl_init')) {
    $curl    = curl_init();
    $timeout = 0;
    curl_setopt($curl, CURLOPT_URL, $link);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
    $buffer = curl_exec($curl);
    curl_close($curl);
    return $buffer;
} elseif (function_exists('file_get_contents')) {
    $buffer = file_get_contents($link);
    return $buffer;
} elseif (function_exists('file')) {
    $buffer = implode('', @file($link));
    return $buffer;
} else {
    return 0;
}
}

then I pass the url as a parameter:

$url = "https://graph.facebook.com/oauth/access_token?client_id=$client_id&client_secret=$client_secret&type=client_credentials&redirect_uri=http://www.mywebsite.com/facebook/&scope=email,offline_access";

echo get_contents($url);

Answers


I think the following link provides the answer: http://developers.facebook.com/docs/authentication/#authenticating-users-in-a-web-application

You first need to call https://graph.facebook.com/oauth/authorize with your client_id and redirect_uri. This will then redirect you back to the redirect_uri, with a verification code in the query string that you can pass to your https://graph.facebook.com/oauth/access_token call (via the code parameter) to exchange for an oAuth access token.

Good luck! :)


Need Your Help

CABasicAnimation responsiveness

ios objective-c swift caanimation

I have a custom UIActivityIndicatorView. It is a view, with a CAAnimation on its layer. The problem is the following:

Where does Web API look in a Web Forms project for Controllers?

asp.net asp.net-mvc-4 asp.net-web-api

I am using Web API in my Web Forms project. I have the following code in my project's Application_Start method in Global.asax: