Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mod: change TaoBao to Taobao

Fix: sort error in generate_sign
  • Loading branch information...
commit 43290f920eac0e61181a3208c2d0e959d0184353 1 parent f5c6834
@nowa nowa authored
View
2  oa-oauth/lib/omniauth/oauth.rb
@@ -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'
View
5 oa-oauth/lib/omniauth/strategies/oauth2/taobao.rb
@@ -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
View
2  oa-oauth/spec/omniauth/strategies/oauth2/taobao_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.