I'm asking myself if it's possible to build a rest api with spring-boot and twitter social login(oauth), and then, allow users to tweet with an image.
A the very begining i just wanted to tweet with an image from the client (rest call via javascript), but i figured out that was not possible unless with twitter card.
thanks you very much for help
You will need to apply to get a developer account. After this, you will be able to register your application to obtain all required secrets/tokens that will be used by your application in all twitter API calls. See detailed steps for oauth login here.
Uploading a picture in Twitter is a 2 steps process:
Upload the picture using the endpoint: POST media/upload
. See documentation
1.1. Extract the media_id from the response for using it in the next step
Create a tweet referecing this image with the endpoint: POST statuses/update
. See documentation
Finally, Twitter4J
is an unofficial client that can ease that for you. See the following example for uploading images: https://github.com/Twitter4J/Twitter4J/blob/master/twitter4j-examples