Module: LinkedIn::Helpers::Authorization

Included in:
Client
Defined in:
lib/linked_in/helpers/authorization.rb

Constant Summary collapse

DEFAULT_OAUTH_OPTIONS =
{
  :request_token_path => "/uas/oauth/requestToken",
  :access_token_path  => "/uas/oauth/accessToken",
  :authorize_path     => "/uas/oauth/authorize",
  :api_host           => "https://api.linkedin.com",
  :auth_host          => "https://www.linkedin.com"
}

Instance Method Summary collapse

Instance Method Details

#access_tokenObject



33
34
35
# File 'lib/linked_in/helpers/authorization.rb', line 33

def access_token
  @access_token ||= ::OAuth::AccessToken.new(consumer, @auth_token, @auth_secret)
end

#authorize_from_access(atoken, asecret) ⇒ Object



37
38
39
# File 'lib/linked_in/helpers/authorization.rb', line 37

def authorize_from_access(atoken, asecret)
  @auth_token, @auth_secret = atoken, asecret
end

#authorize_from_request(request_token, request_secret, verifier_or_pin) ⇒ Object

For web apps use params, for desktop apps, use the verifier is the pin that LinkedIn gives users.



27
28
29
30
31
# File 'lib/linked_in/helpers/authorization.rb', line 27

def authorize_from_request(request_token, request_secret, verifier_or_pin)
  request_token = ::OAuth::RequestToken.new(consumer, request_token, request_secret)
  access_token  = request_token.get_access_token(:oauth_verifier => verifier_or_pin)
  @auth_token, @auth_secret = access_token.token, access_token.secret
end

#consumerObject



14
15
16
# File 'lib/linked_in/helpers/authorization.rb', line 14

def consumer
  @consumer ||= ::OAuth::Consumer.new(@consumer_token, @consumer_secret, parse_oauth_options)
end

#request_token(options = {}) ⇒ Object

Note: If using oauth with a web app, be sure to provide :oauth_callback. Options:

:oauth_callback => String, url that LinkedIn should redirect to


21
22
23
# File 'lib/linked_in/helpers/authorization.rb', line 21

def request_token(options={})
  @request_token ||= consumer.get_request_token(options)
end