I'm encountering an issue while implementing login with Facebook APIs in my Laravel(v5.7) application. When attempting to connect to the Facebook Graph API endpoint (graph.facebook.com:443), I'm receiving the following error:
OpenSSL SSL_connect: Connection was reset in connection to graph.facebook.com:443
This error occurs during the authentication process, and it's preventing users from logging in using their Facebook accounts
code snippet:
public function addFacebookAccount($adsAccount = false) { $message = "Your account is connected. Check back later as data is populated."; $helper = $this->connection()->getRedirectLoginHelper(); if ($state = \Request::get('state', null)) { $helper->getPersistentDataHandler()->set('state', $state); } try { $token = (string) $helper->getAccessToken(); if ($adsAccount) { $fb_user = (new Support\Endpoints\FacebookUser($token))->me(); $account = FacebookApi::firstOrCreate([ 'company_id' => \App\Models\Client::current(), 'social_account_id' => $fb_user['id'] ], ['social_account_name' => $fb_user['name']]); $account->access_token = $token; $account->save(); $this->initializeAdAccountTokens($account->social_account_id, $account->access_token, $account->company_id); } else { $fb_user = (new Support\Endpoints\FacebookUser($token))->me(); $account = FacebookApi::firstOrCreate([ 'company_id' => \App\Models\Client::current(), 'social_account_id' => $fb_user['id'] ], ['social_account_name' => $fb_user['name'], 'is_disabled' => 0]); $account->access_token = $token; $account->save(); $this->insertUserPageTokens($account); } } catch (FacebookResponseException $e) { // When Graph returns an error \Log::info('Graph returned an error: ' . $e->getMessage()); $message = 'We could not log you in at this time'; } catch (FacebookSDKException $e) { // When validation fails or other local issues \Log::info('Facebook SDK returned an error: ' . $e->getMessage()); $message = 'We could not log you in at this time'; } return isset($fb_user) ? ['info' => $message, 'name' => $fb_user['name']]: ['info' => $message]; }
my logs file :
Facebook SDK returned an error: OpenSSL SSL_connect: Connection was reset in connection to graph.facebook.com:443enter image description here
How can I troubleshoot and resolve this issue?