Class: OAuth2::Strategy::WebServer
- Defined in:
- lib/oauth2/strategy/web_server.rb
Instance Method Summary collapse
-
#access_token(*args) ⇒ Object
DEPRECATED: Use #get_access_token instead.
-
#access_token_params(code, options = {}) ⇒ Object
:nodoc:.
-
#authorize_params(options = {}) ⇒ Object
:nodoc:.
-
#get_access_token(code, options = {}) ⇒ Object
Retrieve an access token given the specified validation code.
Methods inherited from Base
#access_token_url, #authorize_url, #initialize
Constructor Details
This class inherits a constructor from OAuth2::Strategy::Base
Instance Method Details
#access_token(*args) ⇒ Object
DEPRECATED: Use #get_access_token instead.
20 21 22 23 |
# File 'lib/oauth2/strategy/web_server.rb', line 20 def access_token(*args) warn '[DEPRECATED] OAuth2::Strategy::WebServer#access_token is deprecated, use #get_access_token instead. Will be removed in 0.1.0' get_access_token(*args) end |
#access_token_params(code, options = {}) ⇒ Object
:nodoc:
25 26 27 28 29 30 |
# File 'lib/oauth2/strategy/web_server.rb', line 25 def access_token_params(code, = {}) #:nodoc: super().merge({ 'type' => 'web_server', 'code' => code }) end |
#authorize_params(options = {}) ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/oauth2/strategy/web_server.rb', line 4 def ( = {}) #:nodoc: super().merge('type' => 'web_server') end |
#get_access_token(code, options = {}) ⇒ Object
Retrieve an access token given the specified validation code. Note that you must also provide a :redirect_uri
option in order to successfully verify your request for most OAuth 2.0 endpoints.
12 13 14 15 16 17 |
# File 'lib/oauth2/strategy/web_server.rb', line 12 def get_access_token(code, = {}) response = @client.request(:get, @client.access_token_url, access_token_params(code, )) params = Rack::Utils.parse_query(response) token = params['access_token'] OAuth2::AccessToken.new(@client, token) end |