Class: OmniAuth::Strategies::Quizlet

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/quizlet.rb

Constant Summary collapse

DEFAULT_SCOPE =
'read'

Instance Method Summary collapse

Instance Method Details

#raw_infoObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/omniauth/strategies/quizlet.rb', line 27

def raw_info
  access_token.options[:mode] = :header
				encoded_auth = Base64.encode64("#{options.client_id}:#{options.client_secret}").strip
  access_token.options[:header_format] = "Basic #{encoded_auth}"
  access_token.options[:param_name] = :code
  access_token.options[:headers] = {
    'grant_type' => 'authorization_code'
  }
  begin
    ops = {
      :headers => { 'grant_type'=>'authorization_code'},
      :body => { 
        'grant_type'=>'authorization_code',
        'code' => @request.params['code']
      }
    }
    @raw_info ||= access_token.post(options.client_options['token_url'],ops).parsed
  rescue Exception => e
    Rails.logger.info e.inspect
  end
end