I am working on a PHP library for handling some limited interaction with Twitter. I already have everything working up to getting an access token and secret (I’m getting the user_id/screen_name so I know that’s working). So now I have this token and token_secret and I want to verify that they are still working.
The documentation page doesn’t really say what I have to send, so I assume it’s just the normal OAuth authentication headers. Here’s an example of what that all looks like:
[type] => GET
[url] => http://api.twitter.com/1/account/verify_credentials.json
[params] => Array
(
[oauth_consumer_key] => xxxEvaxxxxx6qGaxxxxxx
[oauth_nonce] => 41905dd8277ad538aa3b4cb574d1a471
[oauth_signature_method] => HMAC-SHA1
[oauth_timestamp] => 1311202675
[oauth_token] => xxxxxxxx-5AxxxxG1GxxxxxxbhsxxxnXxxxxMxxx
[oauth_version] => 1.0
[oauth_signature] => xxxxxNKRYxxxxxxxG9Y=
)
[headers] => Array
(
[0] => Authorization: OAuth oauth_consumer_key="xxxEvaxxxxx6qGaxxxxxx", oauth_nonce="41905dd8277ad538aa3b4cb574d1a471", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1311202675", oauth_token="xxxxxxxx-5AxxxxG1GxxxxxxbhsxxxnXxxxxMxxx", oauth_version="1.0", oauth_signature="xxxxxNKRYxxxxxxxG9Y="
[1] => Content-Length:
[2] => Expect:
)
Problem is… when I send that all I get back is:
[error] => Could not authenticate with OAuth.
[request] => /1/account/verify_credentials.json
What am I doing wrong?