简体   繁体   中英

Twitter image upload using java script.

I am trying to upload a image to twitter via https://api.twitter.com/1.1/statuses/update_with_media.json API provided by twitter.

I am really confused about the flow for calling this API. How will I get user authenticate and allow my application to post data ? Can anyone give me the exact steps to follow for implementing this ? If any one having sample code for the same that will be most helpful.

If there is any library available for then please direct me to it.

Regards

Are you trying to do this from javascript client code? I had to do that recently, and you're going to have to user server-side code, for two reasons:

  1. You may have to store tokens in your client code. Which would be a security hole.
  2. Twitter API no longer allows cross-browser requests, as their responses don't include 'access-control-allow-origin' headers, so you won't be able to call them via AJAX.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM