Hi together,
I use thmOAuth and have to upgrade to REST API 1.1 because REST API v1 is no more supported. The login process is working and I can read e.g. my name.
Now I want to delete an old tweet. Here my code:
// Example: $tweet_id_str = "253460353529311232";
$tweet_id_str = $get_id_result->getValue("portal_export_id");
$code = $tmhOAuth->user_request(array(
'method' => 'DELETE',
'url' => $tmhOAuth->url('1.1/statuses/destroy.json'),
'params' => array(
'id' => $tweet_id_str
)
));
print "DEBUG: <pre>";
print_r($tmhOAuth->response);
print "</pre>";
Here the relevant part of the response:
Array
(
[raw] => HTTP/1.1 401 Authorization Required
...
{"errors":[{"code":32,"message":"Could not authenticate you."}]}
[headers] => Array
(
[HTTP/1.1 401 Authorization Required] =>
....
)
[code] => 401
[response] => {"errors":[{"code":32,"message":"Could not authenticate you."}]}
[info] => Array
(
[url] => https://api.twitter.com/1.1/statuses/destroy.json
[content_type] => application/json; charset=utf-8
[http_code] => 401
...
[request_header] => DELETE /1.1/statuses/destroy.json HTTP/1.1
User-Agent: tmhOAuth 0.8.4+SSL - //github.com/themattharris/tmhOAuth
Host: api.twitter.com
...
Authorization: OAuth oauth_consumer_key="MYKEY, oauth_nonce="MYNONCE", oauth_signature="MYSIG", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1440061693", oauth_token="MYTOKEN", oauth_version="1.0"
)
...
Can anyone help me? Why do I get the message “Could not authenticate you” when I was able to read my Twitter name just one step before?
Thanks a lot in advance!
Greetings,
Tobias