goでtwitter access tokenを取得する
golang 楽しいです。
twitter の access token を golang で取得してみたメモ。
ChimeraCoder/anaconda を今回は使う。
流れはとても簡単で、
- anaconda.AuthorizationURL("http://localhost:8000/access_token") を呼ぶ
- ブラウザでTwitterの連携許可をする
- 返ってきた値を使ってトークンを取得する anaconda.GetCredentials(credential, r.URL.Query().Get("oauth_verifier"))
これだけで良さだった。
サンプルはこちら
utahta/go-twitter-oauth
READMEの抜粋だけど、このようにすればそのまま使えると思う
$ go get github.com/utahta/go-twitter-oauth $ go-twitter-oauth --- http://localhost:8000 にアクセス ---