Tuesday, October 8, 2013

Twitter Application-Only Authentication with Unity WWW (Javascript)

xkcd is relevant, as always
So I started tinkering on Sunday night with a quick idea that requires some Twitter auth. Other than some scattered stack overflow posts, I couldn't find any simple material for getting this running using the Unity script class WWW.

Twitter's OAuth is pretty finicky but after hitting a dozen 403 Forbidden User and 400 Bad Requests, I finally got an access token with the following code:

Successful responses come in the form of:


Which you can parse out. From there, requesting things like trending topics or executing search queries can be done like so:

The next post will have a demo link to what these will be used for!

No comments:

Post a Comment