OAuth Problem - Access token invalid


#1

Hey this is the problem we’re getting when we try to use the access token form our App. When we take a token straight from the twitter site it works fine, but what we get from the app gives the following error.

{“error”:“Could not authenticate with OAuth.”,“request”:"/1/statuses/update.json"}

Please help!!!


#2

Hey Jacek,

What do you mean by the “access token from our App” vs “the token from the twitter site”? If you’re talking about the “My Access Token” feature on Applications Management pages (https://dev.twitter.com/apps) we are experiencing caching issues with the token displayed there.

We’re working on it and hope to get this problem solved by the end of the week.


#3

Hi @rno

Basically, When we get the token from our app, we write to our db, copy and pate to test it in a php file and we get the following message.

This is the error: {“error”:“Could not authenticate with OAuth.”,“request”:"/1/statuses/update.json"}

We connect in App to twitter, and everything looks good but when we want to share with the App the above error occurs.

Now if we take the access token from my applications it works perfectly fine. I just dont get it.

Edit: and sorry for the late reply was under ground. :slight_smile:


#4

If the Token coming from the “My Access Token” page works, but the one you negotiated in PHP doesn’t, it looks like you’re having an issue with you implementation of the OAuth dance.

Be sure to check these pages:


#5

Hi @rno

We’ve had Outh working for a while with twitter4j, but suddenly we are getting this message after users provide access to our app:
{ “error”: “invalid_token”,
“error_description”: “Invalid access token: 9n3Z6USiPBkExSJGLQgDC2kRLppCg0iItXcZOVNc”}. But the “access_token” is the request token provided by twitter. We didn’t change anything. Any suggestions?


#6

Please Check when i authenticate my apps it is giving error
stdClass Object
(
[error] => This method requires authentication.
[request] => /1/statuses/user_timeline.json?count=40&oauth_consumer_key=s7USZrvC2a68gjC6g0TKg&oauth_nonce=b85dfee9cb87ef7f2e6c863ff41cd26d&oauth_signature=8s%2F9F8hMBnrXZ6gG%2B%2BgnIn5r1Jg%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1312386281&oauth_token=&oauth_version=1.0
)

CHECK MY CODE
++++++++++++++++

$twitteroauth = new TwitterOAuth(‘s7USZrvC2a68gjC6g0TKg’, ‘SNIP’, $_SESSION[‘oauth_token’], $_SESSION[‘oauth_token_secret’]);
// Let’s request the access token
$access_token = $twitteroauth->getAccessToken($_GET[‘oauth_verifier’]);
// Save it in a session var
$_SESSION[‘access_token’] = $access_token;
// Let’s get the user’s info
$user_info = $twitteroauth->get(‘account/verify_credentials’);
$home_timeline = $twitteroauth->get(‘statuses/home_timeline’,array(‘count’ => 40));
$user_timeline = $twitteroauth->get(‘statuses/user_timeline’,array(‘count’ => 40));


#7

@rudsudsandne, you should go to your application settings and reset your consumer key and secret. In the future, it’s best not to post your consumer secret in a public forum. I’ve edited your post to remove the key but you should consider it compromised and not use it for a production application.


#8

Strange, my app was posting fine for the last few days. Now I’m facing the same problem. I get this error [“error”] => string(34) "Could not authenticate with OAuth.

verifyCredentials works but not status update.


#9

I had same problem and it is gone after I regenerate new access token and access secret.


#10

that problems solve is just dont use any character if not english nothing more


#11

Why I am facing problem to retrieve “OAuth - Access Token Retrieval Error” Please give me suggestion for problem ASAP.
public class Constants {

public static final String CONSUMER_KEY = "XXX";
public static final String CONSUMER_SECRET= "XXXXX";

public static final String REQUEST_URL = "http://api.twitter.com/oauth/request_token";
public static final String ACCESS_URL = "http://api.twitter.com/oauth/access_token";
public static final String AUTHORIZE_URL = "http://api.twitter.com/oauth/authorize";

public static final String	OAUTH_CALLBACK_SCHEME	= "x-oauthflow-twitter";
public static final String	OAUTH_CALLBACK_HOST		= "callback";
public static final String	OAUTH_CALLBACK_URL		= OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;

}
try {
provider.retrieveAccessToken(consumer, oauth_verifier);

			final Editor edit = prefs.edit();
			edit.putString(OAuth.OAUTH_TOKEN, consumer.getToken());
			edit.putString(OAuth.OAUTH_TOKEN_SECRET, consumer.getTokenSecret());
			edit.commit();

			String token = prefs.getString(OAuth.OAUTH_TOKEN, "");
			String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, "");

			consumer.setTokenWithSecret(token, secret);
			context.startActivity(new Intent(context,TwitterActivity.class));

			executeAfterAccessTokenRetrieval();

			Log.i(TAG, "OAuth - Access Token Retrieved");

		} catch (Exception e) {
			Log.e(TAG, "OAuth - Access Token Retrieval Error", e);
		}

		return null;

Thanks in advance.


#12

:frowning:


#13

Server Error in ‘/Tweeting’ Application. Invalid token received error


#14

That application was not working properly


#15

I Integrates Twitter On MY Drupal Site Everything goes fine but at last when i registered i got
Invalid Twitter OAuth request… what is that…my site is pune.halosys.us/test
and i write my call back URL is http://pune.halosys.us/test/twitter/oauth

Can You please help me to solve this issue


#16

when i try to use the access token form my App. When we take a token straight from the twitter site it works fine, but what i get from the app it doesn’t tweet the url…Anyone can guide me?


#17

Lorsque j’appuie sur le bouton authoriser l’application (à signer dans mon crm de twitter), je reçois cette erreur
Erreur du serveur DANS L’application ‘/’.

La Valeur etait trop grande ous trop petite Pour Un Int32.

Description: Une exception non Gerée S’est produite au moment de l’exécution de de la personal property actuelle Web. Contrôlez la trace de la pile verser Plus d’informations sur l’Erreur et fils origine de dans le code.

Détails de l’exception: System.OverflowException: La Valeur etait trop grande ous trop petite Pour Un Int32.

Erreur source:

Ligne 49: / / Étape 3 - Remplacer le jeton de demande pour un jeton d’accès
Ligne 50: service de TwitterService = new TwitterService (_consumerKey, _consumerSecret);
Ligne 51: OAuthAccessToken accessToken = service.GetAccessToken (requestToken, oauth_verifier);
Ligne 52: / / Étape 4 - authentifie l’utilisateur à l’aide du jeton d’accès
Ligne 53: service.AuthenticateWith (accessToken.Token, accessToken.TokenSecret);
PS: la ligne 51 est de couleur

Veuillez me répondre svp


#18

I have already problem with api. On script i write the key, but i have this error:

Warning: array_map() [function.array-map]: The first argument, ‘self::add_quotes’, should be either NULL or a valid callback in /web/htdocs/www.maweb.it/home/twitter_api.php on line 46

Warning: http_build_query() [function.http-build-query]: Parameter 1 expected to be Array or Object. Incorrect value given in /web/htdocs/www.maweb.it/home/twitter_api.php on line 48

the error is on this on seguent line:

// also not necessary, but twitter’s demo does this too
$oauth = array_map(“self::add_quotes”, $oauth);
// this is the full value of the Authorization line
$auth = "OAuth " . urldecode(http_build_query($oauth, ‘’, ', '));