我正在处理 twitter 身份验证,一切似乎都运行良好,直到我得到getAccessToken
返回Array ( [ ] => )
。
我做了什么:
第一阶段:
$connection = new TwitterOAuth('xxxxxxxx','xxxxxxxx'); $temporary_credentials = $connection->getRequestToken('http://example.com/profile.php?passurl=1'); $redirect_url = $connection->getAuthorizeURL($temporary_credentials); $_COOKIE['oauth_token'] = $temporary_credentials['oauth_token']; $_COOKIE['oauth_token_secret'] = $temporary_credentials['oauth_token_secret']; header("Location: $redirect_url");
第二阶段(这是我遇到问题的地方)
$connection = new TwitterOAuth( 'xxxxxxxxxx', 'xxxxxxxxxx', $_COOKIE['oauth_token'], $_COOKIE['oauth_token_secret'] ); $token_credentials = $connection->getAccessToken();
我打算将$token_credentials
值保存在数据库中,但它返回一个空数组:Array ( [ ] => )
我做错了什么?