Uncaught OAuthException - how to catch this error?

I have the following error. How can I catch this error?

Fatal error: Uncaught OAuthException: access token verification error: User 638720122 did not allow application 207445576002891. thrown in / var / www / clients / client 1 / web12 / web / socialmediaping / fblibrary / base_facebook.php on line 1039

I have the following code snippet in which I believe. I am trying to manage a bug.

// Attempt to query the graph: $graph_url = "https://graph.facebook.com/me?" . "access_token=" . $access_token; $response = curl_get_file_contents($graph_url); $decoded_response = json_decode($response); //Check for errors if ($decoded_response->error) { $facebookAuth = FALSE; } 

Next, I redirect the user to facebook to get rights if $ facebookAuth == FALSE, but this does not work, so what should I do?

Many thanks for your help.

+4
source share
1 answer

Do not wrap your base_facebook.php! Just use the try / catch block around your image calls:

 try { // check if facebook can get user $facebookUser = $facebook->getUser(); $facebookUser = $facebook->api('me?fields=id,first_name,last_name'); } catch (Exception $e) { // user is not logged in } 
+7
source

Source: https://habr.com/ru/post/1386114/


All Articles