Closed GQwebsites closed 8 years ago
Hey @GQwebsites! You're already catching the FacebookResponseException
. You just need a method to do everything you mentioned after you catch the exception:
try {
$response = $fb->get('/me?fields=permissions');
} catch(\Facebook\Exceptions\FacebookResponseException $e) {
$this->doOtherStuff();
return;
}
@SammyK Thanks, but the problem I'm facing is that no matter what I do after i catch the exception, the code I put in the catch block won't run. here's what i did to test:
try { $response = $fb->get('/me?fields=permissions'); } catch(\Facebook\Exceptions\FacebookResponseException $e) { dd('Test Run'); return; }
and i still get the same response : FacebookResponseException in FacebookResponseException.php line 89: Error validating access token: The user has not authorized application
I know why the exceptionr is getting thrown, its after a user de-authorizes my app. What I can't seem to do is trigger a method to run inside my catch block if the FacebookResponseException is hit.
@SammyK OK I solved it, i didn't know i needed to add use Facebook; to the namespace, all i added was use SammyK\LaravelFacebookSdk\LaravelFacebookSdk;
its all working good now, not sure if mentioned it in the documentation, if you did I must of missed it.
I'm having an issue catching the proper exception, no matter what i do i get the same response. This is the response i get in the view Error validating access token: The user has not authorized application FacebookResponseException in FacebookResponseException.php line 89:
The issue arrises after a user de-authorizes my app from Facebook after have created an access_token , what I ant to do is catch the exception and automatically log them out and flush the session: But i can't seem to find the right exception to catch I've tested with all these: I narrowed the problem to being inside this catch block: I included the catch block, then the full code I'm using in my route's function after.
now my full code for this page: