Skip to content

Commit 66c2ee2

Browse files
committed
Revert "fix: encode client_secret_basic - _ . ! ~ * ' ( ) characters"
This reverts commit 5a2ea80, even though it is the correct implementation some of the most widely used identity providers don't follow the specification.
1 parent 0378bba commit 66c2ee2

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

lib/helpers/client.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,7 @@ const request = require('./request');
99
const { keystores } = require('./weak_cache');
1010
const merge = require('./merge');
1111

12-
function formUrlEncode(token) {
13-
return encodeURIComponent(token).replace(/(?:[-_.!~*'()]|%20)/g, (substring) => {
14-
switch (substring) {
15-
case '-':
16-
case '_':
17-
case '.':
18-
case '!':
19-
case '~':
20-
case '*':
21-
case "'":
22-
case '(':
23-
case ')':
24-
return `%${substring.charCodeAt(0).toString(16).toUpperCase()}`;
25-
case '%20':
26-
return '+';
27-
default:
28-
throw new Error();
29-
}
30-
});
31-
}
12+
const formUrlEncode = (value) => encodeURIComponent(value).replace(/%20/g, '+');
3213

3314
async function clientAssertion(endpoint, payload) {
3415
let alg = this[`${endpoint}_endpoint_auth_signing_alg`];

test/client/client_instance.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ describe('Client', () => {
22742274
expect(await clientInternal.authFor.call(client, 'token')).to.eql({
22752275
headers: {
22762276
Authorization:
2277-
'Basic YW4lM0FpZGVudGlmaWVyOnNvbWUrc2VjdXJlKyUyNitub24lMkRzdGFuZGFyZCtzZWNyZXQ=',
2277+
'Basic YW4lM0FpZGVudGlmaWVyOnNvbWUrc2VjdXJlKyUyNitub24tc3RhbmRhcmQrc2VjcmV0',
22782278
},
22792279
});
22802280
});

0 commit comments

Comments
 (0)