Module: Sorcery::Protocols::Oauth

Included in:
Sorcery::Providers::Jira, Sorcery::Providers::Twitter, Sorcery::Providers::Xing
Defined in:
lib/sorcery/protocols/oauth.rb

Instance Method Summary collapse

Instance Method Details

#authorize_url(args) ⇒ Object



16
17
18
19
20
21
# File 'lib/sorcery/protocols/oauth.rb', line 16

def authorize_url(args)
  get_request_token(
    args[:request_token],
    args[:request_token_secret]
  ).authorize_url(oauth_callback: @callback_url)
end

#get_access_token(args) ⇒ Object



23
24
25
26
27
28
# File 'lib/sorcery/protocols/oauth.rb', line 23

def get_access_token(args)
  get_request_token(
    args[:request_token],
    args[:request_token_secret]
  ).get_access_token(oauth_verifier: args[:oauth_verifier])
end

#get_request_token(token = nil, secret = nil) ⇒ Object



10
11
12
13
14
# File 'lib/sorcery/protocols/oauth.rb', line 10

def get_request_token(token = nil, secret = nil)
  return ::OAuth::RequestToken.new(get_consumer, token, secret) if token && secret

  get_consumer.get_request_token(oauth_callback: @callback_url)
end

#oauth_versionObject



6
7
8
# File 'lib/sorcery/protocols/oauth.rb', line 6

def oauth_version
  '1.0'
end