0

I want to post data on user's twitter timeline which are registered on our website.

Currently, data is posting when I am using sta

$settings = array(
                    'oauth_access_token' => $resultUserData['tw_oauth_token'],
                    'oauth_access_token_secret' => $resultUserData['tw_oauth_token_secret'],
                    'consumer_key' => CONSUMER_KEY,
                    'consumer_secret' => CONSUMER_SECRET
                    );

We have stored

'oauth_access_token' & 'oauth_access_token_secret'

of the user when he allow to post on his twitter timeline.

When I hit the file to wall post then getting an error:

{"errors":[{"code":89,"message":"Invalid or expired token."}]}

I think the issue with the consumer_key and consumer_secret_key

How can I fix the issue?

Vinod Kumar
  • 147
  • 2
  • 11

1 Answers1

0

Before using tokens you can check if they are still ok with "GET account/verify_credentials":

https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials.html

Because a user can revoke access to your app. An answer is here :

Twitter API - Reasons for "invalid or expired token"

JeffProd
  • 3,088
  • 1
  • 19
  • 38