Created
August 16, 2010 04:00
-
-
Save azu/526378 to your computer and use it in GitHub Desktop.
OAuth for NILScriptのサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==NILScript== | |
// @name OAuthTest | |
// @namespace http://efcl.info/ | |
// @description OAuth.ngをinclude | |
// @author azu | |
// @homepage http://efcl.info/ | |
// ==/NILScript== | |
// OAuth.ngを読み込んで実行する - @requireみたいな感じ | |
include("OAuth.ng");// フルパスかまたは相対パス | |
// Twitter appの情報 - 各自のものを使う | |
var clientInfo = { | |
name: 'NILScript', | |
consumerKey: 'T0Wsr0pjQRqV0Xi56g0EJA',// 設定ファイル名に使用 | |
consumerSecret: '3BV9UhiJ97WcW0Phull8NQbnErPLlT3fSDoxHIcJ0Dg', | |
} | |
// TwitterOauthにクライアント情報を渡してnewする(必須) | |
var tw = new TwitterOauth(clientInfo); | |
if(tw.isAuthorize()){ | |
var query = { | |
q : "oauth", | |
per_page : 5 | |
}; | |
tw.get("http://api.twitter.com/1/users/search.json" , query ,function(res){ | |
println(res); | |
}) | |
}else{ // 認証処理 | |
tw.getRequestToken(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment