How to work around Twitter OAuth?

2019-07-13 12:26发布

I've been pushing stuff from our website to our company twitter account automatically. Like some news updates, updates to some sections of our site, etc ... It's all been happening automatically using the Zend Framekwork Twitter service, or other very simple php code that uses a username/password hardcoded.

Now, Twitter killed the old fashion authentication. Which is the right thing to do when offering twitter integration to customers (which use OAuth for user-centric stuff), but for internal stuff, isn't that overkill?

Is there an easy way to update my code to make it work again? Can I somehow hard code an oauth authentication key of some sort so that I don't have to create a whole login process with database storage for a single-user application?

5条回答
在下西门庆
2楼-- · 2019-07-13 12:44
\"骚年 ilove
3楼-- · 2019-07-13 12:46

Rob Allen wrote recently on his blog about Twitter and OAuth (and made a simple application also!): http://akrabat.com/zend-framework/tweetgt-an-example-of-zend_service_twitter-via-oath/

查看更多
爷的心禁止访问
4楼-- · 2019-07-13 12:50

If you already have your system set up to use oAuth, then yes you could just hard code your key and secret key into the system, but otherwise you will have to update to handle oAuth authentication.

Here is a great tutorial to get you in the right direction: http://blog.astrumfutura.com/archives/411-Writing-A-Simple-Twitter-Client-Using-the-PHP-Zend-Frameworks-OAuth-Library-Zend_Oauth.html

Edit:

To Clarify, there is no reason you can't set things up so you connect via oAuth and then just doing this:

$consumer_key = 'xxxxxxxxxxxxxxx';
$consumer_key_secret = 'xxxxxxxxxxxxxxx';
$access_token = 'xxxxxxxxx';
$access_token_secret = 'xxxxxxxx';

$auth = $this->twitter->oauth($consumer_key, $consumer_key_secret, $access_token, $access_token_secret);
查看更多
啃猪蹄的小仙女
5楼-- · 2019-07-13 12:50

Shameless plug - I did a simple blog article on using Oauth with Zend_Service_Twitter. Like another poster said you should double check your ZF version first though.

查看更多
时光不老,我们不散
6楼-- · 2019-07-13 12:56

You could Update your Zend Framework Version.

In Version 1.10.8 of the Framework is an major update for Twitter oAuth included, to make in work again.

Zend Framework 1.10.8 Release

查看更多
登录 后发表回答