/** * @param \Magento\Customer\Model\Customer $customer */ public function disconnect(\Magento\Customer\Model\Customer $customer) { // TODO: Move to \Inchoo\SocialConnect\Model\Facebook\Info\User try { $this->_client->setAccessToken(unserialize($customer->getInchooSocialconnectFtoken())); $this->_client->api('/me/permissions', 'DELETE'); } catch (Exception $e) { } $pictureFilename = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . '/inchoo/socialconnect/facebook/' . $customer->getInchooSocialconnectFid(); if (file_exists($pictureFilename)) { @unlink($pictureFilename); } $customer->setInchooSocialconnectFid(null)->setInchooSocialconnectFtoken(null)->save(); }
/** * * @param \StdClass $token Access token */ public function setAccessToken(\StdClass $token) { $this->_client->setAccessToken($token); }