Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 Auth Client Extension for Tumblr

I'm trying to use the Auth Client Extension in Yii2 (http://www.yiiframework.com/doc-2.0/ext-authclient-index.html). I've copied the Twitter Auth Client class that came with YiiFramework and made my own Tumblr version. Twitter works fine, but when I use my Tumblr version, I get an error on the screen after the "Is it alright for this application to access some of your data and make posts to your account? You are logged in as *********." (Tumblr oauth page)

There error is: Request failed with code: 401, message: oauth_signature does not match expected value

Here is my Tumblr auth client code:


namespace yii\authclient\clients;

use yii\authclient\OAuth1;

/** * * Example application configuration: * * ~~~ * 'components' => [ * 'authClientCollection' => [ * 'class' => 'yii\authclient\Collection', * 'clients' => [ * 'tumblr' => [ * 'class' => 'yii\authclient\clients\Tumblr', * 'consumerKey' => 'tumblr_consumer_key', * 'consumerSecret' => 'tumblr_consumer_secret', * ], * ], * ] * ... * ] * ~~~ * */ class Tumblr extends OAuth1 { /** * @inheritdoc */ public $authUrl = 'https://www.tumblr.com/oauth/authorize'; /** * @inheritdoc */ public $requestTokenUrl = 'https://www.tumblr.com/oauth/request_token'; /** * @inheritdoc */ public $requestTokenMethod = 'POST'; /** * @inheritdoc */ public $accessTokenUrl = 'https://www.tumblr.com/oauth/access_token'; /** * @inheritdoc */ public $accessTokenMethod = 'GET'; /** * @inheritdoc */ public $apiBaseUrl = 'http://api.tumblr.com/v2';

/**
 * @inheritdoc
 */
protected function initUserAttributes()
{
    return $this->api('/user/info', 'GET');
}

/**
 * @inheritdoc
 */
protected function defaultName()
{
    return 'tumblr';
}

/**
 * @inheritdoc
 */
protected function defaultTitle()
{
    return 'Tumblr';
}

}

like image 333
Nate Avatar asked Oct 09 '14 02:10

Nate


1 Answers

You might want to try out Hybridauth's version. I have used the Google and Facebook version in Yii2 and it works fine.

like image 185
adeyemi Avatar answered Nov 09 '22 01:11

adeyemi