3

I am trying to create a tweet and follow a twitter account from springboot application.I am using twitter-api-java-sdk.

TwitterApi apiInstance = new TwitterApi(); TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"), System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"), System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"), System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN")); apiInstance.setTwitterCredentials(credentials);

From where will I get TWITTER_OAUTH2_REFRESH_TOKEN?

I have refereed this document https://developer.twitter.com/en/docs/authentication/oauth-2-0/authorization-code . But I have doubts in while passing the values for refresh_token. Where do I get the value for refresh_token. I have client id. I am bit confused where to get value for refresh_token.

POST 'https://api.twitter.com/2/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'refresh_token=bWRWa3gzdnk3WHRGU1o0bmRRcTJ5VUxWX1lZTDdJSUtmaWcxbTVxdEFXcW5tOjE2MjIxNDc3NDM5MTQ6MToxOnJ0OjE' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id=rG9n6402A3dbUJKzXTNX4oWHJ'
selvi
  • 1,271
  • 2
  • 21
  • 41

0 Answers0