获取"无法验证您"在与亚伯拉罕的TwitterOAuth的联系阶段

时间:2015-05-20 11:54:05

标签: php twitter-oauth

我试图让用户使用简单的Twitter登录来登录我的网站。我已经尝试按照https://twitteroauth.com/redirect.php上的说明进行操作,但提出了一个" Bad身份验证错误"直到我从键中删除了getenv()。

这是我的代码:

require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;

define('CONSUMER_KEY', '<<MY KEY>>');
define('CONSUMER_SECRET', '<<MY SECRET>>');
define('OAUTH_CALLBACK', 'http://www.example.com/inside/index.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);

$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));

回复:

Fatal error: Uncaught exception 'Abraham\TwitterOAuth\TwitterOAuthException' with message '{"errors":[{"code":32,"message":"Could not authenticate you."}]}' in /home/sites/site2/web/inside/twitteroauth/src/TwitterOAuth.php:141 Stack trace: #0 /home/sites/site2/web/inside/index.php(12): Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/request_t...', Array) #1 {main} thrown in /home/sites/site2/web/inside/twitteroauth/src/TwitterOAuth.php on line 141

我在SO和Google上进行的每一次搜索似乎与旧版本的twitteroauth有关 - 我很困惑。

1 个答案:

答案 0 :(得分:0)

如果有其他人反对这一点 - 我发现解决方案是放弃TwitterOAuth而我使用HybridAuth代替。更容易。

相关问题