Skip to content

Commit

Permalink
Calculate signature properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Barbe committed Feb 14, 2013
1 parent 954fc3d commit 600d89e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/mixpanel_api.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class MixpanelAPI
to_be_hashed = ''
for key in keys
continue if key is 'callback' or key is 'sig'
param = {}
param[key] = params[key]
to_be_hashed += querystring.stringify param
to_be_hashed += key + '=' + params[key]
hash = crypto.createHash 'md5'
hash.update to_be_hashed + @options.api_secret
params.sig = hash.digest 'hex'
Expand All @@ -79,4 +77,4 @@ class MixpanelAPI
return console.error err
console.log arguments...

module.exports = MixpanelAPI
module.exports = MixpanelAPI

0 comments on commit 600d89e

Please sign in to comment.