lib/omniauth/strategies/dailycred.rb in dailycred-0.1.36 vs lib/omniauth/strategies/dailycred.rb in dailycred-0.1.41
- old
+ new
@@ -10,16 +10,16 @@
class Dailycred < OmniAuth::Strategies::OAuth2
# default options
option :client_options, {
:site => "https://www.dailycred.com",
- :authorize_url => '/oauth/authorize',
+ :authorize_url => '/connect',
:token_url => '/oauth/access_token'
}
# allows parameters to be passed through
- AUTH_PARAMS = ["action","identity_provider","referrer"]
+ AUTH_PARAMS = ["action","identity_provider","referrer", "access_token"]
option :authorize_options, OmniAuth::Strategies::Dailycred::AUTH_PARAMS
uid { user['id'] }
@@ -55,21 +55,22 @@
def user
return @duser if !@duser.nil?
connection = Faraday::Connection.new options.client_options[:site], :ssl => options.client_options[:ssl]
response = connection.get("/graph/me.json?access_token=#{access_token.token}")
json = JSON.parse(response.body)
- # pp json
+ pp json if options[:verbose]
@duser = {'token' => access_token.token}
@duser['provider'] = 'dailycred'
@duser['uid'] = json['id'] || json['user_id']
json.each do |k,v|
@duser[k] = v
end
json["identities"].each do |k, v|
@duser[k] = v
@duser[k][:access_token] = json["access_tokens"][k]
end if !json["identities"].nil?
- # pp @duser
+ pp @duser if options[:verbose]
+ @duser.delete("id")
@duser
end
end
\ No newline at end of file