Closed gauravgaria closed 8 years ago
I think this just means your access_token, access_token_secret are not valid. Are you getting/updating them correctly. You could always just run as the app only auth if you are testing stuff.
{ consumer_key: '...' , consumer_secret: '...' , app_only_auth: true }
you need to get twitter api tokens
Feel free to reopen if your credentials are valid and you're still having issues! npm update twit
to get the latest version. Thanks :)
I am getting the same error, I tried @onojatreasure solution..but it is not working...
Getting the same error here on my Twitter Bot: https://github.com/thomasfaller/NodeJS-Twitter-bot/blob/master/app.js
I regenerated new tokens and made sure the permissions included 'direct messages' (it doesn't by default, but I still get the error.
Any thoughts?
Hmmm found that comment in the Twitter docs:
Changes to the application permission model will only reflect in access tokens obtained after the permission model change is saved. You will need to re-negotiate existing access tokens to alter the permission level associated with each of your application's users.
So if you change permissions and save, you will need to regenerate new token keys.
Include (- ) in access token .
Regards, Vasundhara.
On Jan 13, 2018 03:28, "Thomas Faller" notifications@github.com wrote:
Hmmm found that comment in the Twitter docs:
Changes to the application permission model will only reflect in access tokens obtained after the permission model change is saved. You will need to re-negotiate existing access tokens to alter the permission level associated with each of your application's users.
So if you change permissions and save, you will need to regenerate new token keys.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ttezel/twit/issues/204#issuecomment-357366028, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbkXsvxrXukxrjQsljDD9Fpo633TTbbks5tJ9WFgaJpZM4F0dRZ .
My Access Token is always Invalid or expired after defollowing one person with my bot, any ideas why?
@filipppp - same issue for me. After unfollowing some users, the token becomes invalid or expired, and I have no idea why. Did you ever figure it out?
Please check if you have properly placed the credentials.
It's all about correctly placing your credentials, keep in mind that changing permissions requires updating creds in your code!
I'm using twitter api v2 and the error {errors: [{message: 'Invalid or expired token', code: 89}]} keeps happening. I tested it with cURL and it worked fine. I have no idea what to do. I've regenerated the tokens, and it still doesn't work.
i get the same errors, has anybody figured this out?
If you only need to access account activity from twitter you can use the bearer token for app credentials.
https://dev.to/twitterdev/a-comprehensive-guide-for-using-the-twitter-api-v2-using-tweepy-in-python-15d9 https://developer.twitter.com/en/docs/authentication/oauth-2-0/bearer-tokens
def get_tweets(username):
# Authorization
client = tweepy.Client(bearer_token=os.getenv('BEARER_TOKEN'))
query = 'from:{}'.format(username)
tweets = client.search_recent_tweets(query=query, tweet_fields=['context_annotations', 'created_at'], max_results=10)
temp = []
for tweet in tweets.data:
temp.append(tweet.text)
return temp
Not able to get the response please help asap getting this error message:- message: 'Invalid or expired token.'
code:-
});
console.log(data) res.json(data); });