Module: Sorcery::Controller::Submodules::External::Protocols::Oauth2

Instance Method Summary collapse

Instance Method Details

#authorize_url(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 12

def authorize_url(options = {})
  defaults = {
      :site => @site,
      :ssl => { :ca_file => Config.ca_file }
  }
  client = ::OAuth2::Client.new(@key, @secret, defaults.merge!(options))
  client.authorize_url(:redirect_uri => @callback_url, :scope => @scope)
end

#get_access_token(args) ⇒ Object



21
22
23
24
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 21

def get_access_token(args)
  client = ::OAuth2::Client.new(@key, @secret, :site => @site, :ssl => { :ca_file => Config.ca_file })
  client.get_token(args[:code], :redirect_uri => @callback_url)
end

#oauth_versionObject



8
9
10
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 8

def oauth_version
  "2.0"
end