auth0 2.40.0 → 2.41.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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.41.0](https://github.com/auth0/node-auth0/tree/v2.41.0) (2022-05-20)
4
+
5
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.40.0...v2.41.0)
6
+
7
+ **Added**
8
+
9
+ - Added ClientsManager.rotateClientSecret method [\#721](https://github.com/auth0/node-auth0/pull/721) ([sbmelvin](https://github.com/sbmelvin))
10
+
3
11
  ## [v2.40.0](https://github.com/auth0/node-auth0/tree/v2.40.0) (2022-02-11)
4
12
 
5
13
  [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.39.0...v2.40.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "2.40.0",
3
+ "version": "2.41.0",
4
4
  "description": "SDK for Auth0 API v2",
5
5
  "main": "src/index.js",
6
6
  "sideEffects": false,
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "homepage": "https://github.com/auth0/node-auth0",
36
36
  "dependencies": {
37
- "axios": "^0.25.0",
37
+ "axios": "^0.26.1",
38
38
  "form-data": "^3.0.1",
39
39
  "jsonwebtoken": "^8.5.1",
40
40
  "jwks-rsa": "^1.12.1",
@@ -54,6 +54,19 @@ class ClientsManager {
54
54
  options.tokenProvider
55
55
  );
56
56
  this.resource = new RetryRestClient(auth0RestClient, options.retry);
57
+
58
+ /**
59
+ * Provides an abstraction layer for consuming the
60
+ * {@link https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret Auth0 Clients Rotate a client secret}.
61
+ *
62
+ * @type {external:RestClient}
63
+ */
64
+ const auth0RotateSecretClient = new Auth0RestClient(
65
+ `${options.baseUrl}/clients/:client_id/rotate-secret`,
66
+ clientOptions,
67
+ options.tokenProvider
68
+ );
69
+ this.rotateSecretResource = new RetryRestClient(auth0RotateSecretClient, options.retry);
57
70
  }
58
71
 
59
72
  /**
@@ -166,6 +179,36 @@ class ClientsManager {
166
179
  delete(...args) {
167
180
  return this.resource.delete(...args);
168
181
  }
182
+
183
+ /**
184
+ * Rotate a client secret
185
+ *
186
+ * @example
187
+ * management.clients.rotateClientSecret({ client_id: CLIENT_ID }, function (err, user) {
188
+ * if (err) {
189
+ * // Handle error.
190
+ * }
191
+ *
192
+ * // Client secret rotated.
193
+ * });
194
+ * @param {object} params params object
195
+ * @param {string} params.client_id Application client ID.
196
+ * @returns {Promise|undefined}
197
+ */
198
+ rotateClientSecret(params, cb) {
199
+ const query = params || {};
200
+
201
+ // Require a client ID.
202
+ if (!params.client_id) {
203
+ throw new ArgumentError('The client_id cannot be null or undefined');
204
+ }
205
+
206
+ if (cb && cb instanceof Function) {
207
+ return this.rotateSecretResource.create(query, {}, cb);
208
+ }
209
+
210
+ return this.rotateSecretResource.create(query, {});
211
+ }
169
212
  }
170
213
 
171
214
  module.exports = ClientsManager;
@@ -3226,10 +3226,10 @@ class ManagementClient {
3226
3226
  }
3227
3227
 
3228
3228
  /**
3229
- * Get the new universal login template.
3229
+ * Set the new universal login template.
3230
3230
  *
3231
3231
  * @example
3232
- * management.setBrandingUniversalLoginTemplate({ template: "a template" }, function (err, template) {
3232
+ * management.setBrandingUniversalLoginTemplate({}, { template: "a template" }, function (err, template) {
3233
3233
  * if (err) {
3234
3234
  * // Handle error.
3235
3235
  * }