oauth4webapi 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,6 +30,8 @@ The following features are currently in scope and implemented in this software:
30
30
 
31
31
  ## [Documentation](docs/README.md)
32
32
 
33
+ `oauth4webapi` is distributed via [npmjs.com](https://www.npmjs.com/package/oauth4webapi), [deno.land/x](https://deno.land/x/oauth4webapi), [cdnjs.com](https://cdnjs.com/libraries/oauth4webapi), [jsdelivr.com](https://www.jsdelivr.com/package/npm/oauth4webapi), and [github.com](https://github.com/panva/oauth4webapi).
34
+
33
35
  ## [Examples](examples/README.md)
34
36
 
35
37
  **`example`** ESM import
@@ -41,7 +43,7 @@ import * as oauth2 from 'oauth4webapi'
41
43
  **`example`** Deno import
42
44
 
43
45
  ```js
44
- import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.4.1/mod.ts'
46
+ import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.4.2/mod.ts'
45
47
  ```
46
48
 
47
49
  - Authorization Code Flow - OpenID Connect [source](examples/code.ts), or plain OAuth 2 [source](examples/oauth.ts)
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let USER_AGENT;
2
2
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
3
3
  const NAME = 'oauth4webapi';
4
- const VERSION = 'v2.4.1';
4
+ const VERSION = 'v2.4.2';
5
5
  USER_AGENT = `${NAME}/${VERSION}`;
6
6
  }
7
7
  export const clockSkew = Symbol();
@@ -265,7 +265,24 @@ function getKeyAndKid(input) {
265
265
  return { key: input.key, kid: input.kid };
266
266
  }
267
267
  function formUrlEncode(token) {
268
- return encodeURIComponent(token).replace(/%20/g, '+');
268
+ return encodeURIComponent(token).replace(/(?:[-_.!~*'()]|%20)/g, (substring) => {
269
+ switch (substring) {
270
+ case '-':
271
+ case '_':
272
+ case '.':
273
+ case '!':
274
+ case '~':
275
+ case '*':
276
+ case "'":
277
+ case '(':
278
+ case ')':
279
+ return `%${substring.charCodeAt(0).toString(16).toUpperCase()}`;
280
+ case '%20':
281
+ return '+';
282
+ default:
283
+ throw new Error();
284
+ }
285
+ });
269
286
  }
270
287
  function clientSecretBasic(clientId, clientSecret) {
271
288
  const username = formUrlEncode(clientId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth4webapi",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "OAuth 2 / OpenID Connect for JavaScript Runtimes",
5
5
  "keywords": [
6
6
  "auth",