Amount of times for authenticating


Hi, i am trying to send a tweet on behalf of a user, but the problem is i cannot send anything after the page i authenticate (my code for sending tweets is on another page, after i have succesfully authenticated the user ).

I included
$twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[‘oauth_token’], $_SESSION[‘oauth_token_secret’]);
on the page i want to send messages so that i could use
$twitteroauth->post(‘statuses/update’, array(‘status’ => $message));
, but i got an “Could not authenticate you” error. all the 4 parameters get passed to this page correctly.

i have no idea what causes the error; is it because i am trying to authenticate the user again while he/she is still logged in? if so what should i do?
Thanks for looking.


ok i did a var_dump and i saw this in the strings
Invalid / expired Token /oauth/ etc
Does this mean that the oauth_token/oauth_token secret received from twitter only lasts for that particular php page?


ok i think i solved it. here are the mistakes i made:

  1. using old oauth tokens for my 2nd TwitterOAuth object declaration when i should be using the tokens i recieved after logging the user into twitter.
  2. trying to get another access token

hope this helps someone


@snscapypara the oauth tokens never expire. They only become invalid if the user revokes twitter access to your application. So you can store those tokens and use them over and over.


Now that have everything updated email all i would like be vetify again so this wont happened again. I was protecting my followers and who was following. Thanks would like blue badge if u could thanks again for ur help. Much appriciated.