Class: OmniAuth::Strategies::Surveymonkey2
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Surveymonkey2
- Defined in:
- lib/omniauth/strategies/surveymonkey2.rb
Constant Summary collapse
- DEFAULT_RESPONSE_TYPE =
'code'
- DEFAULT_GRANT =
'authorization_code'
Instance Method Summary collapse
- #authorize_params ⇒ Object
- #build_access_token ⇒ Object
- #callback_phase ⇒ Object
- #token_params ⇒ Object
Instance Method Details
#authorize_params ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/omniauth/strategies/surveymonkey2.rb', line 20 def super.tap do |params| params[:response_type] ||= DEFAULT_RESPONSE_TYPE params[:client_id] = [:client_id] params[:api_key] = [:api_key] end end |
#build_access_token ⇒ Object
37 38 39 40 |
# File 'lib/omniauth/strategies/surveymonkey2.rb', line 37 def build_access_token verifier = request.params['code'] token = client.auth_code.get_token(verifier, token_params) end |
#callback_phase ⇒ Object
42 43 44 45 46 47 |
# File 'lib/omniauth/strategies/surveymonkey2.rb', line 42 def callback_phase [:client_options][:token_url] = "/oauth/token?api_key=#{[:api_key]}" self.access_token = build_access_token self.env['omniauth.auth'] = auth_hash call_app! end |
#token_params ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/omniauth/strategies/surveymonkey2.rb', line 28 def token_params super.tap do |params| params[:grant_type] ||= DEFAULT_GRANT params[:client_id] = [:client_id] params[:client_secret] = [:client_secret] params[:redirect_uri] = callback_url end end |