I get a TokenResponseException from Laravel when I try to access my website using Facebook oauth-4-laravel .
OAuth \ Common \ Http \ Exception \ TokenResponseException
Failed to request resource.
Using the Facebook JavaScript API works as intended, so I'm sure my app is set up correctly.
Are there any known issues that may cause this issue? Am I doing something wrong, or is this a bug in the library?
With the exception of the redirect line that runs around another error , my code is identical to the code example on the GitHub page. I think an exception is thrown when I try to get a token from a Facebook service object.
Here is the code:
public function loginWithFacebook() {
$code = Input::get( 'code' );
$fb = OAuth::consumer( 'Facebook' );
if ( !empty( $code ) ) {
$token = $fb->requestAccessToken( $code );
$result = json_decode( $fb->request( '/me' ), true );
$message = 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
echo $message. "<br/>";
dd($result);
}
else {
$url = $fb->getAuthorizationUri();
return Redirect::to((string)$url);
}
}
And screenshot :

Thank.