Could not authenticate with OAuth


#1

Hi,

I am using themattharris’ OAuth PHP library (which works perfectly by the way), but I stumbled upon a problem during the OAuth authentication.
When I try to tweet something, I get the following error message;

stdClass Object
(
[error] => Could not authenticate with OAuth.
[request] => /1/statuses/update.json
)

I am using the following code to tweet;

<?php

require 'tmh/tmhOAuth.php';
require 'tmh/tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'XXXXXXXXXXX',
'consumer_secret' => 'XXXXXXXXXXXXXXXXXXXXXX',
'user_token' => 'XXXX-XXXXXXXXXXXXXXXXXXX',
'user_secret' => 'XXXXXXXXXXXXXXXXXXXXXX'));

$code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array('status' => 'My Twitter Message'));

tmhUtilities::pr(json_decode($tmhOAuth->response['response']));

?>

I copied all tokens, keys & secrets from the My Applications page into the file, but it does not seem to work.

What’s going wrong here? I am almost 100% certain it has nothing to do with the library.

Any help is much appreciated!

-Kjeld


#2

… Also facing this. All requests work except status posting.

Signature strings, authentication look exactly as docs specify.

Thanks for the response


#3

The “Could not authenticate with OAuth” error means the oauth_token and oauth_secret are no longer valid. Earlier today we had some similar reports saying the values copied directly from the “Your access token” section of this site were not working.

We’re investigating this at the moment.


#4

I’ve got the same problem. Sending tweet works fine immediately after authenticating. But after a few hours, same error ‘could not authenticate with oauth’ comes up.


#5

Hi, Same problem here, just changed the permission, regenerated the key and it still dosen’t work


#6

Im having the same issue but when using the friendship/create.


#7

Sample problem here too. status/update always fails right after authentication. But it succeeds after the app (iOS) restarted. Please note when this issue fixed.


#8

Having the issue today with a web app that I am working on - is this problem still present?


#9

Since i use Abraham’s twitteroauth, i have no problems. try https://github.com/abraham/twitteroauth


#10

I am also having this problem - all other API calls work. Please email me for example of the code


#11

Could you please share with us more details?

  • Which API calls are working, and which are not?
  • What is your access_token scope (R, R&W or R&W+DM)? What about your Application?
  • Ideally, could you share the full HTTP Request & Result (Headers + Body)?

#12

I have got it working - I was not putting the status param in the extra_params in the auth header.

Sorry for wasting anyone’s time.


#13

I’m still having the same problem…here is the query generated from my code

http://api.twitter.com/1/statuses/update.json?oauth_consumer_key=xxx&oauth_version=1.0&oauth_signature_method=HMAC-SHA1&oauth_signature=Lu4%2FQh9DH%2Ff5MjudzS08dGf%2Fnws%3D&oauth_timestamp=1313228753&oauth_nonce=5203210113310391010&oauth_token=xxx&status=%40MrBankole%20%3A)&in_reply_to_status_id=102270228553142272


#14

the only weird thing I can notice in the url is the “)” in your “status” GET parameter. everything else seems fine.


#15

It seems, that I have the very same problem.

I’m using Twitterizer .NET library for posting tweets within a web-site into my twitter account. It works just fine on site, running on my local server (authenticates with OAuth through twitter app and posts a tweet). But when I’m trying to post a tweet on production server, Twitterizer says: “Result = Unauthorized. ErrorMessage = Could not authenticate with OAuth.”

I double checked consumer keys, also tried to reset the keys, create another app and try again - same result.

Twitter application has read/write access to my twitter account and is not blocked. This problem appeared suddenly on 08/12 after a period of successful working for about a month, when tweets were posted every hour or so.


#16

2 days ago, my app works fine, but today, I have same error : “Could not authenticate you” :frowning:


#17

Why the application does a redirect to my site without any options?


#18

Have you changed something in your app?


#19

Make sure that you haven’t accidentally invalidated your access tokens. You can invalidate an access token by:

  • Hitting the “No Thanks” button on the oauth/authorize or oauth/authenticate pages
  • Revoking access from https://twitter.com/settings/applications
  • Regenerating your access token on dev.twitter.com
  • Upgrading the permission level of an already authorized user and application combo. All previous strings/access tokens are then invalidated.

#20

Bump. Get the same error.