0

Since Twitter has deprecated its API V1, I need to update my code to use V2. I am using the twitter4j-v2 library: https://github.com/takke/twitter4j-v2

I'm stuck at the oAuth authentication step. I manage to generate the URL:

val conf = ConfigurationBuilder()
  .setOAuthConsumerKey(CONSUMER_KEY_CAT)
  .setOAuthConsumerSecret(CONSUMER_SECRET_CAT)
  .setOAuth2AccessToken(ACCESS_TOKEN)
  .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET)
  .setDebugEnabled(true)

//Ask oAuthRequestToken
val twitter = TwitterFactory(conf.build()).instance
val oAuthRequestToken = twitter.oAuthRequestToken
println(oAuthRequestToken)
println(oAuthRequestToken.authorizationURL)

I also manage to get the callback sent by Twitter:

//oauth_token=O-3YAAAAAAABp...
//oauth_verifier=cIQde1fjyhdmBP...

However, I don't know what to do with this information to post a Tweet. Can anyone help?

Anthone
  • 2,156
  • 21
  • 26

0 Answers0