Permalink
Browse files

Merge pull request #436 from nowa/master

Bug fix for taobao oauth login
  • Loading branch information...
2 parents f5c6834 + 0613246 commit 72a93c5a4ca0475a9ee029d529f230bb29f340c5 @sferik sferik committed Aug 23, 2011
@@ -57,7 +57,7 @@ module Strategies
autoload :Renren, 'omniauth/strategies/oauth2/renren'
autoload :Salesforce, 'omniauth/strategies/oauth2/salesforce'
autoload :SoundCloud, 'omniauth/strategies/oauth2/sound_cloud'
- autoload :TaoBao, 'omniauth/strategies/oauth2/taobao'
+ autoload :Taobao, 'omniauth/strategies/oauth2/taobao'
autoload :Teambox, 'omniauth/strategies/oauth2/teambox'
autoload :ThirtySevenSignals, 'omniauth/strategies/oauth2/thirty_seven_signals'
autoload :Viadeo, 'omniauth/strategies/oauth2/viadeo'
@@ -42,6 +42,7 @@ def user_info
'location' => user_hash['location'],
'image' => user_hash['profile_image_url'],
'description' => user_hash['description'],
+ 'email' => user_hash['email']
'urls' => {
'T163' => 'http://t.163.com',
},
@@ -10,7 +10,7 @@ module Strategies
#
# @example Basic Usage
# use OmniAuth::Strategies::TaoBao, 'client_id', 'client_secret'
- class TaoBao < OmniAuth::Strategies::OAuth2
+ class Taobao < OmniAuth::Strategies::OAuth2
# @param [Rack Application] app standard middleware application parameter
# @param [String] client_id the app key at taobao open platform
# @param [String] client_secret the app secret at taobao open platform
@@ -71,7 +71,8 @@ def user_info
end
def generate_sign(params)
- str = client_secret + (params.sort.collect { |k, v| "#{k}#{v}" }).join + client_secret
+ # params.sort.collect { |k, v| "#{k}#{v}" }
+ str = client_secret + params.sort {|a,b| "#{a[0]}"<=>"#{b[0]}"}.flatten.join + client_secret
params['sign'] = Digest::MD5.hexdigest(str).upcase!
params
end
@@ -1,5 +1,5 @@
require 'spec_helper'
-describe OmniAuth::Strategies::TaoBao do
+describe OmniAuth::Strategies::Taobao do
it_should_behave_like "an oauth2 strategy"
end

0 comments on commit 72a93c5

Please sign in to comment.