Loading src/FacebookPostAuthManager.php +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\social_post_facebook; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\Session; use Drupal\social_post\PostManager; use League\OAuth2\Client\Provider\Facebook; /** * Manages the authorization process and post on user behalf. Loading src/Form/FacebookPostSettingsForm.php +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ class FacebookPostSettingsForm extends ConfigFormBase { ->set('app_id', $values['app_id']) ->set('app_secret', $values['app_secret']) ->set('graph_version', $values['graph_version']) ->set('oauth_redirect_url', $values['oauth_redirect_url']) ->save(); parent::submitForm($form, $form_state); Loading src/Plugin/Network/FacebookPost.php +7 −7 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { protected $urlGenerator; /** * Facebook connection. * Facebook client. * * @var \Facebook\Facebook * @var \League\OAuth2\Client\Provider\Facebook */ protected $connection; protected $client; /** * The status text. Loading Loading @@ -144,8 +144,8 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { return new Facebook([ 'clientId' => $settings->getAppId(), 'clientSecret' => $settings->getAppSecret(), 'redirectUri' => $settings->getOauthRedirectUrl(), 'graphApiVersion' => 'v' . $settings->getGraphVersion() . '.0', // 'redirectUri' => 'https://example.com/user/social-post/facebook/auth', ]); } Loading Loading @@ -177,11 +177,11 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { * {@inheritdoc} */ public function post() { if (!$this->connection) { if (!$this->client) { throw new SocialApiException('Call post() method from its wrapper doPost()'); } $message = $this->connection->post('me/feed', ['message' => $this->status], $this->accessToken); $message = $this->client->post('me/feed', ['message' => $this->status], $this->accessToken); if ($message->getHttpStatusCode() != 200) { return FALSE; Loading @@ -194,7 +194,7 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { * {@inheritdoc} */ public function doPost($access_token, $status) { $this->connection = $this->getSdk(); $this->client = $this->getSdk(); $this->status = $status; $this->accessToken = $access_token; return $this->post(); Loading src/Settings/FacebookPostSettings.php +11 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class FacebookPostSettings extends SettingsBase implements FacebookPostSettingsI protected $defaultToken; /** * The redirect URL for social_auth implmeneter. * The redirect URL for social_auth implementer. * * @var string */ Loading Loading @@ -74,4 +74,14 @@ class FacebookPostSettings extends SettingsBase implements FacebookPostSettingsI return $this->graphVersion; } /** * {@inheritdoc} */ public function getOauthRedirectUrl() { if (!$this->oauthRedirectUrl) { $this->oauthRedirectUrl = $this->config->get('oauth_redirect_url'); } return $this->oauthRedirectUrl; } } Loading
src/FacebookPostAuthManager.php +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\social_post_facebook; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\Session; use Drupal\social_post\PostManager; use League\OAuth2\Client\Provider\Facebook; /** * Manages the authorization process and post on user behalf. Loading
src/Form/FacebookPostSettingsForm.php +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ class FacebookPostSettingsForm extends ConfigFormBase { ->set('app_id', $values['app_id']) ->set('app_secret', $values['app_secret']) ->set('graph_version', $values['graph_version']) ->set('oauth_redirect_url', $values['oauth_redirect_url']) ->save(); parent::submitForm($form, $form_state); Loading
src/Plugin/Network/FacebookPost.php +7 −7 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { protected $urlGenerator; /** * Facebook connection. * Facebook client. * * @var \Facebook\Facebook * @var \League\OAuth2\Client\Provider\Facebook */ protected $connection; protected $client; /** * The status text. Loading Loading @@ -144,8 +144,8 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { return new Facebook([ 'clientId' => $settings->getAppId(), 'clientSecret' => $settings->getAppSecret(), 'redirectUri' => $settings->getOauthRedirectUrl(), 'graphApiVersion' => 'v' . $settings->getGraphVersion() . '.0', // 'redirectUri' => 'https://example.com/user/social-post/facebook/auth', ]); } Loading Loading @@ -177,11 +177,11 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { * {@inheritdoc} */ public function post() { if (!$this->connection) { if (!$this->client) { throw new SocialApiException('Call post() method from its wrapper doPost()'); } $message = $this->connection->post('me/feed', ['message' => $this->status], $this->accessToken); $message = $this->client->post('me/feed', ['message' => $this->status], $this->accessToken); if ($message->getHttpStatusCode() != 200) { return FALSE; Loading @@ -194,7 +194,7 @@ class FacebookPost extends NetworkBase implements FacebookPostInterface { * {@inheritdoc} */ public function doPost($access_token, $status) { $this->connection = $this->getSdk(); $this->client = $this->getSdk(); $this->status = $status; $this->accessToken = $access_token; return $this->post(); Loading
src/Settings/FacebookPostSettings.php +11 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class FacebookPostSettings extends SettingsBase implements FacebookPostSettingsI protected $defaultToken; /** * The redirect URL for social_auth implmeneter. * The redirect URL for social_auth implementer. * * @var string */ Loading Loading @@ -74,4 +74,14 @@ class FacebookPostSettings extends SettingsBase implements FacebookPostSettingsI return $this->graphVersion; } /** * {@inheritdoc} */ public function getOauthRedirectUrl() { if (!$this->oauthRedirectUrl) { $this->oauthRedirectUrl = $this->config->get('oauth_redirect_url'); } return $this->oauthRedirectUrl; } }