Skip to content

Instantly share code, notes, and snippets.

@azu
Created August 16, 2010 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/526378 to your computer and use it in GitHub Desktop.
Save azu/526378 to your computer and use it in GitHub Desktop.
OAuth for NILScriptのサンプル
// ==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