Commit 5b608e72fa3182ac7f5cf88ad68cc1e0a10b76c8

Authored by jasl
1 parent 19660247
Exists in master

escape redirect_uri

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
lib/wx_pay/service.rb
1 1 require 'rest_client'
2 2 require 'json'
  3 +require 'cgi'
3 4 require 'securerandom'
4 5 require 'active_support/core_ext/hash/conversions'
5 6  
... ... @@ -9,7 +10,7 @@ module WxPay
9 10  
10 11 def self.generate_authorize_url(redirect_uri, state = nil)
11 12 state ||= SecureRandom.hex 16
12   - "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{WxPay.appid}&redirect_uri=#{redirect_uri}&response_type=code&scope=snsapi_base&state=#{state}"
  13 + "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{WxPay.appid}&redirect_uri=#{CGI::escape redirect_uri}&response_type=code&scope=snsapi_base&state=#{state}"
13 14 end
14 15  
15 16 def self.authenticate(authorization_code, options = {})
... ...