TweetSharp Losing Connection When Restarting Debug Mode?

20 Views Asked by At

I'm storing the access token in the DB that I get via:

    Dim requestToken As New OAuthRequestToken With {.Token = oauthToken}
    Dim twitSvc As New TwitterService(SocialMediaService.TwitterConsumerKey, SocialMediaService.TwitterConsumerSecret)
    Dim accessToken As OAuthAccessToken = twitSvc.GetAccessToken(requestToken, oauthVerifier)

    twitSvc.AuthenticateWith(accessToken.Token, accessToken.TokenSecret)

Then, when I get the token and make a request in the same debug session, tweets are returned as expected. However, if I restart the debug mode and try and get the token/secret from the DB and make the same request again, the service returns Nothing.

    Dim token = db.AmpConfigs.Where(Function(c) c.name = "twitter_token" AndAlso c.type = "social").FirstOrDefault()
    Dim tokenSecret = db.AmpConfigs.Where(Function(c) c.name = "twitter_token_secret" AndAlso c.type = "social").FirstOrDefault()

    Dim twitSvc As New TwitterService(SocialMediaService.TwitterConsumerKey, SocialMediaService.TwitterConsumerSecret)

    twitSvc.AuthenticateWith(token.value, tokenSecret.value)

    Dim twitUser As TwitterUser = twitSvc.VerifyCredentials(New VerifyCredentialsOptions With {.IncludeEntities = True, .SkipStatus = False})

    Dim tweets = twitSvc.ListTweetsOnUserTimeline(New ListTweetsOnUserTimelineOptions With {.Count = 100})
0

There are 0 best solutions below