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 |
# 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.(: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_version ⇒ Object
8 9 10 |
# File 'lib/sorcery/controller/submodules/external/protocols/oauth2.rb', line 8 def oauth_version "2.0" end |