discourse/discourse — pull request #1020 by chrishunt (2013-06-13 05:53:14+00:00)
Title: Use Twitter 1.1 OAuth for Twitter onebox

[meta/7410](http://meta.discourse.org/t/twitter-oneboxes-are-bust/7410)

This PR updates the Twitter onebox to use the application-only auth described [HERE](https://dev.twitter.com/docs/auth/application-only-auth) without introducing another gem dependency.

Generating a Twitter onebox takes two requests: one to fetch the bearer_token and other to grab the tweet.

This can be slightly improved in another PR by saving the bearer_token (maybe on the class instead of instance?) and re-using for as long as we can. When it expires, we can rescue the forbidden response and fetch another one. We can make that change later if there's a need.

Twitter oneboxes are back!

![screen shot 2013-06-12 at 10 41 59 pm](https://f.cloud.github.com/assets/65323/646951/62e4ec76-d3ed-11e2-8430-04cf2513f341.png)