Class: OAuth::RequestToken

Inherits:
ConsumerToken show all
Defined in:
lib/oauth/token.rb

Overview

The RequestToken is used for the initial Request. This is normally created by the Consumer object.

Instance Attribute Summary

Attributes inherited from ConsumerToken

#consumer

Attributes inherited from Token

#secret, #token

Instance Method Summary collapse

Methods inherited from ConsumerToken

#initialize

Methods inherited from Token

#initialize, #to_query

Methods included from Key

#escape, #generate_key

Constructor Details

This class inherits a constructor from OAuth::ConsumerToken

Instance Method Details

#authorize_urlObject

Returns the authorization url that you need to use for redirecting the user



43
44
45
# File 'lib/oauth/token.rb', line 43

def authorize_url
  consumer.authorize_url+"?oauth_token="+CGI.escape(token)
end

#get_access_tokenObject

exchange for AccessToken on server



48
49
50
51
52
# File 'lib/oauth/token.rb', line 48

def get_access_token
  request=consumer.create_request(consumer.http_method,consumer.access_token_path,{:oauth_token=>self.token})
  response=request.perform_token_request(consumer.secret,self.secret)
  OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret])
end