Encode parameters correctly when building an OAuth base string
authorTom Hughes <tom@compton.nu>
Sat, 27 Apr 2013 11:20:16 +0000 (12:20 +0100)
committerTom Hughes <tom@compton.nu>
Sat, 27 Apr 2013 11:20:16 +0000 (12:20 +0100)
Parameter key and value escaping needs to use the extended algorithm
from the OAuth specification, not the standard URI escaping algorithm
so we need to escape !, ', *, ( and ) characters.

vendor/assets/ohauth/ohauth.js

index 0497da87c81fbb37b6aba9a67ab4c69d4c49913d..419fb2a1a611a83584db66aea192d62344b2fc09 100644 (file)
@@ -4,8 +4,8 @@ var ohauth = {};
 
 ohauth.qsString = function(obj) {
     return Object.keys(obj).sort().map(function(key) {
-        return encodeURIComponent(key) + '=' +
-            encodeURIComponent(obj[key]);
+        return ohauth.percentEncode(key) + '=' +
+            ohauth.percentEncode(obj[key]);
     }).join('&');
 };