auth0 3.4.0 → 3.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.6.0](https://github.com/auth0/node-auth0/tree/v3.6.0) (2023-07-18)
4
+
5
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.5.0...v3.6.0)
6
+
7
+ **Added**
8
+
9
+ - Support Organization Name [\#884](https://github.com/auth0/node-auth0/pull/884) ([frederikprijck](https://github.com/frederikprijck))
10
+
11
+ **Changed**
12
+
13
+ - Do not lowercase org_name claim [\#887](https://github.com/auth0/node-auth0/pull/887) ([frederikprijck](https://github.com/frederikprijck))
14
+
15
+ ## [v3.5.0](https://github.com/auth0/node-auth0/tree/v3.5.0) (2023-06-26)
16
+
17
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.4.0...v3.5.0)
18
+
19
+ **Added**
20
+
21
+ - Add option to pass x-request-language header for passwordless [\#873](https://github.com/auth0/node-auth0/pull/873) ([adamjmcgrath](https://github.com/adamjmcgrath))
22
+
3
23
  ## [v3.4.0](https://github.com/auth0/node-auth0/tree/v3.4.0) (2023-05-05)
4
24
 
5
25
  [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.3.0...v3.4.0)
package/README.md CHANGED
@@ -63,6 +63,8 @@ var management = new ManagementClient({
63
63
  });
64
64
  ```
65
65
 
66
+ > Note: The domain should not include `https://` the ManagementClient will prepend that to the string.
67
+
66
68
  For other examples see the [EXAMPLES.md](https://github.com/auth0/node-auth0/blob/master/EXAMPLES.md) document.
67
69
 
68
70
  ## API Reference
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "SDK for Auth0 API v2",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.mjs",
@@ -8,9 +8,10 @@ function getParamsFromOptions(options) {
8
8
  if (!options || typeof options !== 'object') {
9
9
  return params;
10
10
  }
11
- if (options.forwardedFor) {
11
+ if (options.forwardedFor || options.requestLanguage) {
12
12
  params._requestCustomizer = function (req) {
13
- req.set('auth0-forwarded-for', options.forwardedFor);
13
+ options.forwardedFor && req.set('auth0-forwarded-for', options.forwardedFor);
14
+ options.requestLanguage && req.set('x-request-language', options.requestLanguage);
14
15
  };
15
16
  }
16
17
  return params;
@@ -214,6 +215,7 @@ class PasswordlessAuthenticator {
214
215
  * @param {string} userData.send The type of email to be sent.
215
216
  * @param {object} [options] Additional options.
216
217
  * @param {string} [options.forwardedFor] Value to be used for auth0-forwarded-for header
218
+ * @param {string} [options.requestLanguage] Specify a language for the message area.
217
219
  * @param {Function} [cb] Method callback.
218
220
  * @returns {Promise|undefined}
219
221
  */
@@ -270,6 +272,7 @@ class PasswordlessAuthenticator {
270
272
  * @param {string} userData.phone_number User phone number.
271
273
  * @param {object} [options] Additional options.
272
274
  * @param {string} [options.forwardedFor] Value to be used for auth0-forwarded-for header
275
+ * @param {string} [options.requestLanguage] Specify a language for the message area.
273
276
  * @param {Function} [cb] Method callback.
274
277
  * @returns {Promise|undefined}
275
278
  */
@@ -84,14 +84,28 @@ const validate = function (token, options) {
84
84
 
85
85
  // Organization
86
86
  if (options.organization) {
87
- if (!payload.org_id || typeof payload.org_id !== 'string') {
88
- throw new Error('Organization Id (org_id) claim must be a string present in the ID token');
89
- }
90
-
91
- if (payload.org_id !== options.organization) {
92
- throw new Error(
93
- `Organization Id (org_id) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_id}"'`
94
- );
87
+ if (options.organization.indexOf('org_') === 0) {
88
+ if (!payload.org_id || typeof payload.org_id !== 'string') {
89
+ throw new Error('Organization Id (org_id) claim must be a string present in the ID token');
90
+ }
91
+
92
+ if (payload.org_id !== options.organization) {
93
+ throw new Error(
94
+ `Organization Id (org_id) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_id}"'`
95
+ );
96
+ }
97
+ } else {
98
+ if (!payload.org_name || typeof payload.org_name !== 'string') {
99
+ throw new Error(
100
+ 'Organization Name (org_name) claim must be a string present in the ID token'
101
+ );
102
+ }
103
+
104
+ if (payload.org_name !== options.organization.toLowerCase()) {
105
+ throw new Error(
106
+ `Organization Name (org_name) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_name}"'`
107
+ );
108
+ }
95
109
  }
96
110
  }
97
111