Here 당신이 토큰 및 omniauth에서 비밀을 가지고 있기 때문에 당신이 필요하므로 정확히, 지금 당신은 그것을 사용하려고 :
다음
def prepare_access_token(oauth_token, oauth_token_secret)
consumer = OAuth::Consumer.new("APIKey", "APISecret", { :site => "https://api.twitter.com", :request_token_path => '/oauth/request_token', :access_token_path => '/oauth/access_token', :authorize_path => '/oauth/authorize', :scheme => :header })
token_hash = { :oauth_token => oauth_token, :oauth_token_secret => oauth_token_secret } access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
return access_token
end
하면, 예를 들어, 게시물을 트윗 :
msg = {'status' => 'Hey look I can tweet via OAuth!'}
access_token = prepare_access_token(token, secret)
response = access_token.post('https://api.twitter.com/1/statuses/update.json', msg, { 'Accept' => 'application/xml' })
자세한 내용은 링크에있는 기사를 읽으십시오.
감사합니다. – santosh