Skip to content

Daum OAuth API client library for ruby. (아직 블로그 API에 대한 메소드는 작성중이기 때문에 사용하지 마세요)

Notifications You must be signed in to change notification settings

thefron/daum_oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daum OAuth

About

This is Daum OAuth client API library for ruby.

Motivated by moomerman’s twitter_oauth gem (github.com/moomerman/twitter_oauth)

OAuth specs: oauth.net/core/1.0/

OAuth Introduction @ Daum DNA: apis.daum.net/oauth/

Installing

sudo gem install daum_oauth

Source code is available at github.com/thefron/daum_oauth

Usage

client = DaumOAuth::Client.new( :consumer_key => ‘YOUR_APP_CONSUMER_KEY’, :consumer_secret => ‘YOUR_APP_CONSUMER_SECRET’ ) request_token = client.request_token(:oauth_callback => ‘callback_url’) #:oauth_callback must be specified

request_token.authorize_url => apis.daum.net/oauth/authorize?oauth_token=TOKEN

In your application, make users redirect to the authorize_url(daum). Before redirection, store the request token and secret(usually in the session).Then users will authorize the application and be redirected to callback_url you’ve specified before.

Then in callback procedure,

access_token = client.authorize( request_token.token, request_token.secret, :oauth_verifier => params )

#For now, there’s no method for checking authorization’s validity. #At least, you can try this if your application makes use of yozm. client.yozm_authorized? => true

client.yozm_add ‘message here’ # sends a yozm message

Now if you can keep access_token(usually in the database) for this user, you won’t need re-authorize them next time. Just initialize a client instance with stored access_token when needed.

access_token = @user.access_token #assuming @user

client = DaumOAuth::Client.new( :consumer_key => ‘YOUR_APP_CONSUMER_KEY’, :consumer_secret => ‘YOUR_APP_CONSUMER_SECRET’, :token => access_token.token, :secret=> access_token.secret )

You are ready to access protected resource.

About

Daum OAuth API client library for ruby. (아직 블로그 API에 대한 메소드는 작성중이기 때문에 사용하지 마세요)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages