class OmniAuth::Strategies::Etencent

Public Instance Methods

authorize_params() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/etencent.rb, line 16
def authorize_params
  super.tap do |params|
    %w[scope client_options].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
        # to support omniauth-oauth2's auto csrf protection
        session['omniauth.state'] = params[:state] if v == 'state'
      end
    end
  end
end
authorizer_info() click to toggle source
# File lib/omniauth/strategies/etencent.rb, line 50
def authorizer_info
  @authorizer_info ||= access_token.to_hash.dig('authorizer_info') || {}
end
request_phase() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/etencent.rb, line 58
def request_phase
  session['omniauth.redirect_uri'] = callback_url
  super
end
scope() click to toggle source
# File lib/omniauth/strategies/etencent.rb, line 54
def scope
  authorizer_info['scope_list']
end

Protected Instance Methods

api_base_url() click to toggle source
# File lib/omniauth/strategies/etencent.rb, line 74
def api_base_url
  options.sandbox ? 'https://sandbox-api.e.qq.com' : 'https://api.e.qq.com'
end
client() click to toggle source
# File lib/omniauth/strategies/etencent.rb, line 65
def client
  ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(client_options))
end
client_options() click to toggle source
# File lib/omniauth/strategies/etencent.rb, line 69
def client_options
  options.client_options[:token_url] = "#{api_base_url}#{options.client_options[:token_url]}" if options.client_options[:token_url] !~ /https?:\/\//
  options.client_options
end
token_params() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/etencent.rb, line 78
def token_params
  super.merge(authorization_code: request.params['authorization_code'], redirect_uri: session['omniauth.redirect_uri'])
end