Class: OmniAuth::Strategies::Bungie

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

Instance Method Summary collapse

Instance Method Details

#build_access_tokenObject



52
53
54
55
56
57
# File 'lib/omniauth/strategies/bungie.rb', line 52

def build_access_token
  verifier = request.params["code"]
  client.auth_code.get_token(verifier,
                             token_params.to_hash(symbolize_keys: true),
                             deep_symbolize(options.auth_token_params))
end

#clientObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/omniauth/strategies/bungie.rb', line 14

def client
  client_options = options.client_options.merge(
    :connection_opts => {
      :headers => { 'X-API-Key' => options.api_key }
    },
    :redirect_uri => options.redirect_uri
  )

  ::OAuth2::Client.new(
    options.client_id,
    options.client_secret,
    deep_symbolize(client_options)
  )
end

#raw_infoObject



45
46
47
48
49
50
# File 'lib/omniauth/strategies/bungie.rb', line 45

def raw_info
  return @raw_info unless @raw_info.nil?

  @raw_info = access_token.get('/Platform/User/GetMembershipsForCurrentUser/').parsed
  @raw_info = (@raw_info['ErrorCode'] == 1) ? @raw_info['Response'] : {}
end