Skip to content

Commit

Permalink
Merge pull request #2 from brendte/master
Browse files Browse the repository at this point in the history
Adds uid to the response hash, as well as the full raw_data hash to extra.
  • Loading branch information
arunagw committed Nov 30, 2011
2 parents d38bbf0 + e81734a commit d248e62
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/omniauth/strategies/foursquare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ class Foursquare < OmniAuth::Strategies::OAuth2
:authorize_url => '/oauth2/authorize',
:token_url => '/oauth2/access_token'
}

uid { raw_info['id'] }

info do
{
:first_name => raw_info['firstName'],
:last_name => raw_info['lastName']
}
end

extra do
{ :raw_info => raw_info }
end

def request_phase
options[:authorize_params] = client_params.merge(options[:authorize_params])
Expand All @@ -18,14 +31,7 @@ def auth_hash
OmniAuth::Utils.deep_merge(super, client_params.merge({
:grant_type => 'authorization_code'}))
end

info do
{
:first_name => raw_info['firstName'],
:last_name => raw_info['lastName']
}
end


def raw_info
access_token.options[:mode] = :query
access_token.options[:param_name] = :oauth_token
Expand Down

0 comments on commit d248e62

Please sign in to comment.