From 8abd201b3c39a500aba0d76373eb614431450a83 Mon Sep 17 00:00:00 2001 From: Paul Klimov Date: Mon, 23 Dec 2013 13:31:49 +0200 Subject: [PATCH] Twitter auth client added. --- extensions/yii/authclient/clients/Twitter.php | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 extensions/yii/authclient/clients/Twitter.php diff --git a/extensions/yii/authclient/clients/Twitter.php b/extensions/yii/authclient/clients/Twitter.php new file mode 100644 index 0000000..4add039 --- /dev/null +++ b/extensions/yii/authclient/clients/Twitter.php @@ -0,0 +1,53 @@ + + * @since 2.0 + */ +class Twitter extends OAuth1 +{ + /** + * @inheritdoc + */ + public function __construct($config = []) + { + $config = array_merge( + [ + 'consumerKey' => 'anonymous', + 'consumerSecret' => 'anonymous', + 'requestTokenUrl' => 'https://api.twitter.com/oauth/request_token', + 'requestTokenMethod' => 'POST', + 'accessTokenUrl' => 'https://api.twitter.com/oauth/access_token', + 'accessTokenMethod' => 'POST', + 'authUrl' => 'https://api.twitter.com/oauth/authorize', + 'scope' => '', + 'apiBaseUrl' => 'https://api.twitter.com/1.1', + ], + $config + ); + parent::__construct($config); + } + + /** + * @inheritdoc + */ + protected function initUserAttributes() + { + return $this->api('account/verify_credentials.json', 'GET'); + } +} \ No newline at end of file