Class: OAuth2::Strategy::AuthCode
- Defined in:
- lib/oauth2/strategy/auth_code.rb
Overview
The Authorization Code Strategy
Instance Method Summary collapse
- 
  
    
      #authorize_params(params = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The required query parameters for the authorize URL. 
- 
  
    
      #authorize_url(params = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The authorization URL endpoint of the provider. 
- 
  
    
      #get_token(code, params = {}, opts = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Retrieve an access token given the specified validation code. 
Methods inherited from Base
Constructor Details
This class inherits a constructor from OAuth2::Strategy::Base
Instance Method Details
#authorize_params(params = {}) ⇒ Object
The required query parameters for the authorize URL
| 10 11 12 | # File 'lib/oauth2/strategy/auth_code.rb', line 10 def (params = {}) params.merge('response_type' => 'code', 'client_id' => @client.id) end | 
#authorize_url(params = {}) ⇒ Object
The authorization URL endpoint of the provider
| 17 18 19 | # File 'lib/oauth2/strategy/auth_code.rb', line 17 def (params = {}) @client.(.merge(params)) end | 
#get_token(code, params = {}, opts = {}) ⇒ Object
    Note:
    
  
that you must also provide a :redirect_uri with most OAuth 2.0 providers
Retrieve an access token given the specified validation code.
| 27 28 29 30 31 | # File 'lib/oauth2/strategy/auth_code.rb', line 27 def get_token(code, params = {}, opts = {}) params = {'grant_type' => 'authorization_code', 'code' => code}.merge(@client.redirection_params).merge(params) @client.get_token(params, opts) end |