Quantcast
Channel: The Rabbit Hole
Viewing all articles
Browse latest Browse all 18

Twitter Application-Only Authentication with Unity WWW (Javascript)

$
0
0
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:

{"token_type":"bearer","access_token":"AAAA%2FAAA%3DAAAAAAAA"}

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!

Viewing all articles
Browse latest Browse all 18

Trending Articles