question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PublishTweet no exception for "Invalid or expired token"

See original GitHub issue

Hi,

Follow this code:

ITwitterCredentials credentials = Auth.SetUserCredentials(website.TwitterConsumerKey, website.TwitterConsumerSecret, authorizationKey, authorizationSecret);
ITweet theTweet = await TweetAsync.PublishTweet(message);
ITwitterException ex = ExceptionHandler.GetLastException();

With wrong credential (user has remove its authorization), PublishTweet return null. BUG: ExceptionHandler.GetLastException(); return no exception !!!

But if I don’t use Async:

ITwitterCredentials credentials = Auth.SetUserCredentials(website.TwitterConsumerKey, website.TwitterConsumerSecret, authorizationKey, authorizationSecret);
ITweet theTweet = Tweet.PublishTweet(message);
ITwitterException ex = ExceptionHandler.GetLastException();

With wrong credential (user has remove its authorization), PublishTweet return null. And ex contain ““Unauthorized - Authentication credentials were missing or incorrect.”” The behavior is OK.

Regards

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
daikozcommented, Jan 13, 2019

ok work fine

0reactions
linvicommented, Dec 9, 2019

This issue will be fixed by Tweetinvi 5.0 as it no longer relies on ThreadStatic or AsyncContext.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Twitter API - Reasons for "invalid or expired token"
1. This error occurs when the token you're using is either expired or invalid. Verify that the strings you're using for access token...
Read more >
Get an Invalid or Expired Token Error Response
Get an Invalid or Expired Token Error Response. The following error can occur if you have regenerated tokens or revoked access to your...
Read more >
Invalid or expired token after few API requests
Dear community, My twitter app (@CancellerBot) encounters the error 89 (“Invalid or expired token.”) regularly now, for no obvious reasons.
Read more >
Cannot enable 2FA on ring.com with invalid/expired token ...
After entering the code generated by 1Password on Ring's page, I am getting an "Invalid or expired code." error as shown here.
Read more >
Troubleshooting "Invalid Token Provided" Error on ...
The error occurs when the API token linked to the Org2Org application has expired. API tokens have an expiration date and need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found