Facebook Oauth 2.0 Token errors
- by James
The user clicks the URL that is generated via the code below.
$url = 'https://graph.facebook.com/oauth/authorize?' .
http_build_query(array('client_id' => FACEBOOK_APP_ID,
'redirect_uri' => 'http://fb.example.com/facebook',
'scope' => 'publish_stream,email,offline_access,user_location,user_hometown',
'display' => 'page'));
Upon granting access to the application, and redirecting to http://fb.example.com/facebook I grab the following URL using cURL.
$url = 'http://graph.facebook.com/oauth/access_token?' .
http_build_query(array('client_id' => FACEBOOK_APP_ID,
'client_secret' => FACEBOOK_SECRET,
'redirect_uri' => 'http://fb.example.com/facebook',
'code' => $params['code']));
This returns the error below that I receive when grabbing the above URL.
{
"error": {
"type": "OAuthException",
"message": "Error validating verification code."
}
}
Any ideas? Really getting stuck on this.