Commit 16802bac53e483967d91a79639cda0a83758ac05

Authored by Jeff Lai
1 parent 36fae25c
Exists in master

Fix js package

Showing 1 changed file with 6 additions and 4 deletions   Show diff stats
lib/dingtalk/client.rb
@@ -30,12 +30,14 @@ module Dingtalk @@ -30,12 +30,14 @@ module Dingtalk
30 end 30 end
31 31
32 def jssign_package(request_url) 32 def jssign_package(request_url)
33 - sort_params = [base.js_ticket, timestamp, nonce, request_url].sort.join  
34 - signature = Digest::SHA1.hexdigest(sort_params) 33 + the_timestamp = timestamp
  34 + the_nonce = nonce
  35 + str = "jsapi_ticket=#{base.js_ticket}&noncestr=#{the_nonce}&timestamp=#{the_timestamp}&url=#{request_url}"
  36 + signature = Digest::SHA1.hexdigest(str)
35 { 37 {
36 corp_id: @corp_id, 38 corp_id: @corp_id,
37 - timeStamp: timestamp,  
38 - nonceStr: nonce, 39 + timeStamp: the_timestamp,
  40 + nonceStr: the_nonce,
39 signature: signature 41 signature: signature
40 } 42 }
41 end 43 end