Module: Sorcery::Controller::Submodules::External::Protocols::Oauth2
- Included in:
- Sorcery::Controller::Submodules::External::Providers::Facebook::FacebookClient, Sorcery::Controller::Submodules::External::Providers::Github::GithubClient
- Defined in:
- lib/sorcery/controller/submodules/external/protocols/oauth2.rb
Instance Method Summary collapse
Instance Method Details
#authorize_url(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 12 def ( = {}) defaults = { :site => @site, :ssl => { :ca_file => Config.ca_file } } client = ::OAuth2::Client.new( @key, @secret, defaults.merge!() ) client.web_server.( :redirect_uri => @callback_url, :scope => @scope ) end |
#get_access_token(args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 28 def get_access_token(args) client = ::OAuth2::Client.new( @key, @secret, :site => @site, :ssl => { :ca_file => Config.ca_file } ) client.web_server.get_access_token( args[:code], :redirect_uri => @callback_url ) end |
#oauth_version ⇒ Object
8 9 10 |
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 8 def oauth_version "2.0" end |