1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Merge pull request #436 from nowa/master

Bug fix for taobao oauth login
This commit is contained in:
Erik Michaels-Ober 2011-08-22 23:26:47 -07:00
commit 72a93c5a4c
4 changed files with 6 additions and 4 deletions

View file

@ -57,7 +57,7 @@ module OmniAuth
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'

View file

@ -42,6 +42,7 @@ module OmniAuth
'location' => user_hash['location'],
'image' => user_hash['profile_image_url'],
'description' => user_hash['description'],
'email' => user_hash['email']
'urls' => {
'T163' => 'http://t.163.com',
},

View file

@ -10,7 +10,7 @@ module OmniAuth
#
# @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 @@ module OmniAuth
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

View file

@ -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