auth0 2.36.2 → 2.39.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 +41 -0
- package/README.md +33 -11
- package/package.json +22 -14
- package/src/Auth0RestClient.js +72 -71
- package/src/RetryRestClient.js +78 -81
- package/src/auth/DatabaseAuthenticator.js +242 -259
- package/src/auth/OAUthWithIDTokenValidation.js +99 -103
- package/src/auth/OAuthAuthenticator.js +325 -344
- package/src/auth/PasswordlessAuthenticator.js +238 -252
- package/src/auth/TokensManager.js +231 -246
- package/src/auth/UsersManager.js +149 -160
- package/src/auth/idToken.js +22 -19
- package/src/auth/index.js +510 -581
- package/src/errors.js +23 -23
- package/src/index.js +3 -2
- package/src/management/ActionsManager.js +510 -584
- package/src/management/BlacklistedTokensManager.js +77 -84
- package/src/management/BrandingManager.js +141 -163
- package/src/management/ClientGrantsManager.js +132 -145
- package/src/management/ClientsManager.js +145 -161
- package/src/management/ConnectionsManager.js +215 -204
- package/src/management/CustomDomainsManager.js +140 -157
- package/src/management/DeviceCredentialsManager.js +95 -111
- package/src/management/EmailProviderManager.js +110 -128
- package/src/management/EmailTemplatesManager.js +96 -112
- package/src/management/GrantsManager.js +94 -101
- package/src/management/GuardianManager.js +381 -455
- package/src/management/HooksManager.js +283 -325
- package/src/management/JobsManager.js +310 -343
- package/src/management/LogStreamsManager.js +142 -158
- package/src/management/LogsManager.js +92 -99
- package/src/management/ManagementTokenProvider.js +112 -120
- package/src/management/MigrationsManager.js +81 -90
- package/src/management/OrganizationsManager.js +686 -761
- package/src/management/PromptsManager.js +160 -182
- package/src/management/ResourceServersManager.js +143 -160
- package/src/management/RolesManager.js +323 -369
- package/src/management/RulesConfigsManager.js +94 -110
- package/src/management/RulesManager.js +154 -176
- package/src/management/StatsManager.js +87 -103
- package/src/management/TenantManager.js +81 -97
- package/src/management/TicketsManager.js +107 -115
- package/src/management/UserBlocksManager.js +135 -162
- package/src/management/UsersManager.js +729 -852
- package/src/management/index.js +3094 -3619
- package/src/utils.js +31 -60
|
@@ -1,165 +1,152 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const { ArgumentError } = require('rest-facade');
|
|
2
|
+
const Auth0RestClient = require('../Auth0RestClient');
|
|
3
|
+
const RetryRestClient = require('../RetryRestClient');
|
|
4
|
+
|
|
5
5
|
/**
|
|
6
|
-
* @class ClientGrantsManager
|
|
7
6
|
* Auth0 Client Grants Manager.
|
|
8
7
|
*
|
|
9
8
|
* See {@link https://auth0.com/docs/api/v2#!/Client_Grants Client Grants}
|
|
10
|
-
*
|
|
11
|
-
* @constructor
|
|
12
|
-
* @memberOf module:management
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} options The client options.
|
|
15
|
-
* @param {String} options.baseUrl The URL of the API.
|
|
16
|
-
* @param {Object} [options.headers] Headers to be included in all requests.
|
|
17
|
-
* @param {Object} [options.retry] Retry Policy Config
|
|
18
9
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
class ClientGrantsManager {
|
|
11
|
+
/**
|
|
12
|
+
* @param {object} options The client options.
|
|
13
|
+
* @param {string} options.baseUrl The URL of the API.
|
|
14
|
+
* @param {object} [options.headers] Headers to be included in all requests.
|
|
15
|
+
* @param {object} [options.retry] Retry Policy Config
|
|
16
|
+
*/
|
|
17
|
+
constructor(options) {
|
|
18
|
+
if (options === null || typeof options !== 'object') {
|
|
19
|
+
throw new ArgumentError('Must provide client options');
|
|
20
|
+
}
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (options.baseUrl === null || options.baseUrl === undefined) {
|
|
23
|
+
throw new ArgumentError('Must provide a base URL for the API');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
|
|
27
|
+
throw new ArgumentError('The provided base URL is invalid');
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Options object for the Rest Client instance.
|
|
32
|
+
*
|
|
33
|
+
* @type {object}
|
|
34
|
+
*/
|
|
35
|
+
const clientOptions = {
|
|
36
|
+
errorFormatter: { message: 'message', name: 'error' },
|
|
37
|
+
headers: options.headers,
|
|
38
|
+
query: { repeatParams: false },
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Provides an abstraction layer for consuming the
|
|
43
|
+
* {@link https://auth0.com/docs/api/v2#!/Client_Grants Auth0 Client Grants endpoint}.
|
|
44
|
+
*
|
|
45
|
+
* @type {external:RestClient}
|
|
46
|
+
*/
|
|
47
|
+
const auth0RestClient = new Auth0RestClient(
|
|
48
|
+
`${options.baseUrl}/client-grants/:id`,
|
|
49
|
+
clientOptions,
|
|
50
|
+
options.tokenProvider
|
|
51
|
+
);
|
|
52
|
+
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
30
53
|
}
|
|
31
54
|
|
|
32
55
|
/**
|
|
33
|
-
*
|
|
56
|
+
* Create an Auth0 client grant.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* management.clientGrants.create(data, function (err) {
|
|
60
|
+
* if (err) {
|
|
61
|
+
* // Handle error.
|
|
62
|
+
* }
|
|
34
63
|
*
|
|
35
|
-
*
|
|
64
|
+
* // Client grant created.
|
|
65
|
+
* });
|
|
66
|
+
* @param {object} data The client data object.
|
|
67
|
+
* @param {Function} [cb] Callback function.
|
|
68
|
+
* @returns {Promise|undefined}
|
|
36
69
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
query: { repeatParams: false }
|
|
41
|
-
};
|
|
70
|
+
create(...args) {
|
|
71
|
+
return this.resource.create(...args);
|
|
72
|
+
}
|
|
42
73
|
|
|
43
74
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
75
|
+
* Get all Auth0 Client Grants.
|
|
76
|
+
*
|
|
77
|
+
* @example <caption>
|
|
78
|
+
* This method takes an optional object as first argument that may be used to
|
|
79
|
+
* specify pagination settings. If pagination options are not present,
|
|
80
|
+
* the first page of a limited number of results will be returned.
|
|
81
|
+
* </caption>
|
|
46
82
|
*
|
|
47
|
-
*
|
|
83
|
+
* // Pagination settings.
|
|
84
|
+
* var params = {
|
|
85
|
+
* per_page: 10,
|
|
86
|
+
* page: 0
|
|
87
|
+
* };
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* management.clientGrants.getAll(params, function (err, grants) {
|
|
91
|
+
* console.log(grants.length);
|
|
92
|
+
* });
|
|
93
|
+
* @param {object} [params] Client Grants parameters.
|
|
94
|
+
* @param {number} [params.per_page] Number of results per page.
|
|
95
|
+
* @param {number} [params.page] Page number, zero indexed.
|
|
96
|
+
* @param {Function} [cb] Callback function.
|
|
97
|
+
* @returns {Promise|undefined}
|
|
48
98
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
options.tokenProvider
|
|
53
|
-
);
|
|
54
|
-
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Create an Auth0 client grant.
|
|
59
|
-
*
|
|
60
|
-
* @method create
|
|
61
|
-
* @memberOf module:management.ClientGrantsManager.prototype
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* management.clientGrants.create(data, function (err) {
|
|
65
|
-
* if (err) {
|
|
66
|
-
* // Handle error.
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
69
|
-
* // Client grant created.
|
|
70
|
-
* });
|
|
71
|
-
*
|
|
72
|
-
* @param {Object} data The client data object.
|
|
73
|
-
* @param {Function} [cb] Callback function.
|
|
74
|
-
*
|
|
75
|
-
* @return {Promise|undefined}
|
|
76
|
-
*/
|
|
77
|
-
utils.wrapPropertyMethod(ClientGrantsManager, 'create', 'resource.create');
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get all Auth0 Client Grants.
|
|
81
|
-
*
|
|
82
|
-
* @method getAll
|
|
83
|
-
* @memberOf module:management.ClientGrantsManager.prototype
|
|
84
|
-
*
|
|
85
|
-
* @example <caption>
|
|
86
|
-
* This method takes an optional object as first argument that may be used to
|
|
87
|
-
* specify pagination settings. If pagination options are not present,
|
|
88
|
-
* the first page of a limited number of results will be returned.
|
|
89
|
-
* </caption>
|
|
90
|
-
*
|
|
91
|
-
* // Pagination settings.
|
|
92
|
-
* var params = {
|
|
93
|
-
* per_page: 10,
|
|
94
|
-
* page: 0
|
|
95
|
-
* };
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* management.clientGrants.getAll(params, function (err, grants) {
|
|
99
|
-
* console.log(grants.length);
|
|
100
|
-
* });
|
|
101
|
-
*
|
|
102
|
-
* @param {Object} [params] Client Grants parameters.
|
|
103
|
-
* @param {Number} [params.per_page] Number of results per page.
|
|
104
|
-
* @param {Number} [params.page] Page number, zero indexed.
|
|
105
|
-
* @param {Function} [cb] Callback function.
|
|
106
|
-
*
|
|
107
|
-
* @return {Promise|undefined}
|
|
108
|
-
*/
|
|
109
|
-
utils.wrapPropertyMethod(ClientGrantsManager, 'getAll', 'resource.getAll');
|
|
99
|
+
getAll(...args) {
|
|
100
|
+
return this.resource.getAll(...args);
|
|
101
|
+
}
|
|
110
102
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
* @return {Promise|undefined}
|
|
139
|
-
*/
|
|
140
|
-
utils.wrapPropertyMethod(ClientGrantsManager, 'update', 'resource.patch');
|
|
103
|
+
/**
|
|
104
|
+
* Update an Auth0 client grant.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* var data = {
|
|
108
|
+
* client_id: CLIENT_ID,
|
|
109
|
+
* audience: AUDIENCE,
|
|
110
|
+
* scope: []
|
|
111
|
+
* };
|
|
112
|
+
* var params = { id: CLIENT_GRANT_ID };
|
|
113
|
+
*
|
|
114
|
+
* management.clientGrants.update(params, data, function (err, grant) {
|
|
115
|
+
* if (err) {
|
|
116
|
+
* // Handle error.
|
|
117
|
+
* }
|
|
118
|
+
*
|
|
119
|
+
* console.log(grant.id);
|
|
120
|
+
* });
|
|
121
|
+
* @param {object} params Client parameters.
|
|
122
|
+
* @param {string} params.id Client grant ID.
|
|
123
|
+
* @param {object} data Updated client data.
|
|
124
|
+
* @param {Function} [cb] Callback function.
|
|
125
|
+
* @returns {Promise|undefined}
|
|
126
|
+
*/
|
|
127
|
+
update(...args) {
|
|
128
|
+
return this.resource.patch(...args);
|
|
129
|
+
}
|
|
141
130
|
|
|
142
|
-
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*/
|
|
163
|
-
utils.wrapPropertyMethod(ClientGrantsManager, 'delete', 'resource.delete');
|
|
131
|
+
/**
|
|
132
|
+
* Delete an Auth0 client grant.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* management.clientGrants.delete({ id: GRANT_ID }, function (err) {
|
|
136
|
+
* if (err) {
|
|
137
|
+
* // Handle error.
|
|
138
|
+
* }
|
|
139
|
+
*
|
|
140
|
+
* // Grant deleted.
|
|
141
|
+
* });
|
|
142
|
+
* @param {object} params Client parameters.
|
|
143
|
+
* @param {string} params.id Client grant ID.
|
|
144
|
+
* @param {Function} [cb] Callback function.
|
|
145
|
+
* @returns {Promise|undefined}
|
|
146
|
+
*/
|
|
147
|
+
delete(...args) {
|
|
148
|
+
return this.resource.delete(...args);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
164
151
|
|
|
165
152
|
module.exports = ClientGrantsManager;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var RetryRestClient = require('../RetryRestClient');
|
|
1
|
+
const { ArgumentError } = require('rest-facade');
|
|
2
|
+
const Auth0RestClient = require('../Auth0RestClient');
|
|
3
|
+
const RetryRestClient = require('../RetryRestClient');
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* @class ClientsManager
|
|
8
6
|
* Auth0 Clients Manager.
|
|
9
7
|
*
|
|
10
8
|
* {@link https://auth0.com/docs/api/v2#!/Clients Clients} represent
|
|
@@ -12,176 +10,162 @@ var RetryRestClient = require('../RetryRestClient');
|
|
|
12
10
|
* You can learn more about this in the
|
|
13
11
|
* {@link https://auth0.com/docs/applications Applications} section of the
|
|
14
12
|
* documentation.
|
|
15
|
-
* @constructor
|
|
16
|
-
* @memberOf module:management
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} options The client options.
|
|
19
|
-
* @param {String} options.baseUrl The URL of the API.
|
|
20
|
-
* @param {Object} [options.headers] Headers to be included in all requests.
|
|
21
|
-
* @param {Object} [options.retry] Retry Policy Config
|
|
22
13
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
class ClientsManager {
|
|
15
|
+
/**
|
|
16
|
+
* @param {object} options The client options.
|
|
17
|
+
* @param {string} options.baseUrl The URL of the API.
|
|
18
|
+
* @param {object} [options.headers] Headers to be included in all requests.
|
|
19
|
+
* @param {object} [options.retry] Retry Policy Config
|
|
20
|
+
*/
|
|
21
|
+
constructor(options) {
|
|
22
|
+
if (options === null || typeof options !== 'object') {
|
|
23
|
+
throw new ArgumentError('Must provide client options');
|
|
24
|
+
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (options.baseUrl === null || options.baseUrl === undefined) {
|
|
27
|
+
throw new ArgumentError('Must provide a base URL for the API');
|
|
28
|
+
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
|
|
31
|
+
throw new ArgumentError('The provided base URL is invalid');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options object for the Rest Client instance.
|
|
36
|
+
*
|
|
37
|
+
* @type {object}
|
|
38
|
+
*/
|
|
39
|
+
const clientOptions = {
|
|
40
|
+
errorFormatter: { message: 'message', name: 'error' },
|
|
41
|
+
headers: options.headers,
|
|
42
|
+
query: { repeatParams: false },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Provides an abstraction layer for consuming the
|
|
47
|
+
* {@link https://auth0.com/docs/api/v2#!/Clients Auth0 Clients endpoint}.
|
|
48
|
+
*
|
|
49
|
+
* @type {external:RestClient}
|
|
50
|
+
*/
|
|
51
|
+
const auth0RestClient = new Auth0RestClient(
|
|
52
|
+
`${options.baseUrl}/clients/:client_id`,
|
|
53
|
+
clientOptions,
|
|
54
|
+
options.tokenProvider
|
|
55
|
+
);
|
|
56
|
+
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
34
57
|
}
|
|
35
58
|
|
|
36
59
|
/**
|
|
37
|
-
*
|
|
60
|
+
* Create an Auth0 client.
|
|
38
61
|
*
|
|
39
|
-
* @
|
|
62
|
+
* @example
|
|
63
|
+
* management.clients.create(data, function (err) {
|
|
64
|
+
* if (err) {
|
|
65
|
+
* // Handle error.
|
|
66
|
+
* }
|
|
67
|
+
*
|
|
68
|
+
* // Client created.
|
|
69
|
+
* });
|
|
70
|
+
* @param {object} data The client data object.
|
|
71
|
+
* @param {Function} [cb] Callback function.
|
|
72
|
+
* @returns {Promise|undefined}
|
|
40
73
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
query: { repeatParams: false }
|
|
45
|
-
};
|
|
74
|
+
create(...args) {
|
|
75
|
+
return this.resource.create(...args);
|
|
76
|
+
}
|
|
46
77
|
|
|
47
78
|
/**
|
|
48
|
-
*
|
|
49
|
-
* {@link https://auth0.com/docs/api/v2#!/Clients Auth0 Clients endpoint}.
|
|
79
|
+
* Get all Auth0 clients.
|
|
50
80
|
*
|
|
51
|
-
* @
|
|
81
|
+
* @example <caption>
|
|
82
|
+
* This method takes an optional object as first argument that may be used to
|
|
83
|
+
* specify pagination settings. If pagination options are not present,
|
|
84
|
+
* the first page of a limited number of results will be returned.
|
|
85
|
+
* </caption>
|
|
86
|
+
*
|
|
87
|
+
* // Pagination settings.
|
|
88
|
+
* var params = {
|
|
89
|
+
* per_page: 10,
|
|
90
|
+
* page: 0
|
|
91
|
+
* };
|
|
92
|
+
*
|
|
93
|
+
* management.clients.getAll(params, function (err, clients) {
|
|
94
|
+
* console.log(clients.length);
|
|
95
|
+
* });
|
|
96
|
+
* @param {object} [params] Clients parameters.
|
|
97
|
+
* @param {number} [params.per_page] Number of results per page.
|
|
98
|
+
* @param {number} [params.page] Page number, zero indexed.
|
|
99
|
+
* @param {Function} [cb] Callback function.
|
|
100
|
+
* @returns {Promise|undefined}
|
|
52
101
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
options.tokenProvider
|
|
57
|
-
);
|
|
58
|
-
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create an Auth0 client.
|
|
63
|
-
*
|
|
64
|
-
* @method create
|
|
65
|
-
* @memberOf module:management.ClientsManager.prototype
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* management.clients.create(data, function (err) {
|
|
69
|
-
* if (err) {
|
|
70
|
-
* // Handle error.
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* // Client created.
|
|
74
|
-
* });
|
|
75
|
-
*
|
|
76
|
-
* @param {Object} data The client data object.
|
|
77
|
-
* @param {Function} [cb] Callback function.
|
|
78
|
-
*
|
|
79
|
-
* @return {Promise|undefined}
|
|
80
|
-
*/
|
|
81
|
-
utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create');
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Get all Auth0 clients.
|
|
85
|
-
*
|
|
86
|
-
* @method getAll
|
|
87
|
-
* @memberOf module:management.ClientsManager.prototype
|
|
88
|
-
*
|
|
89
|
-
* @example <caption>
|
|
90
|
-
* This method takes an optional object as first argument that may be used to
|
|
91
|
-
* specify pagination settings. If pagination options are not present,
|
|
92
|
-
* the first page of a limited number of results will be returned.
|
|
93
|
-
* </caption>
|
|
94
|
-
*
|
|
95
|
-
* // Pagination settings.
|
|
96
|
-
* var params = {
|
|
97
|
-
* per_page: 10,
|
|
98
|
-
* page: 0
|
|
99
|
-
* };
|
|
100
|
-
*
|
|
101
|
-
* management.clients.getAll(params, function (err, clients) {
|
|
102
|
-
* console.log(clients.length);
|
|
103
|
-
* });
|
|
104
|
-
*
|
|
105
|
-
* @param {Object} [params] Clients parameters.
|
|
106
|
-
* @param {Number} [params.per_page] Number of results per page.
|
|
107
|
-
* @param {Number} [params.page] Page number, zero indexed.
|
|
108
|
-
* @param {Function} [cb] Callback function.
|
|
109
|
-
*
|
|
110
|
-
* @return {Promise|undefined}
|
|
111
|
-
*/
|
|
112
|
-
utils.wrapPropertyMethod(ClientsManager, 'getAll', 'resource.getAll');
|
|
102
|
+
getAll(...args) {
|
|
103
|
+
return this.resource.getAll(...args);
|
|
104
|
+
}
|
|
113
105
|
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* @return {Promise|undefined}
|
|
134
|
-
*/
|
|
135
|
-
utils.wrapPropertyMethod(ClientsManager, 'get', 'resource.get');
|
|
106
|
+
/**
|
|
107
|
+
* Get an Auth0 client.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* management.clients.get({ client_id: CLIENT_ID }, function (err, client) {
|
|
111
|
+
* if (err) {
|
|
112
|
+
* // Handle error.
|
|
113
|
+
* }
|
|
114
|
+
*
|
|
115
|
+
* console.log(client);
|
|
116
|
+
* });
|
|
117
|
+
* @param {object} params Client parameters.
|
|
118
|
+
* @param {string} params.client_id Application client ID.
|
|
119
|
+
* @param {Function} [cb] Callback function.
|
|
120
|
+
* @returns {Promise|undefined}
|
|
121
|
+
*/
|
|
122
|
+
get(...args) {
|
|
123
|
+
return this.resource.get(...args);
|
|
124
|
+
}
|
|
136
125
|
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
* @return {Promise|undefined}
|
|
161
|
-
*/
|
|
162
|
-
utils.wrapPropertyMethod(ClientsManager, 'update', 'resource.patch');
|
|
126
|
+
/**
|
|
127
|
+
* Update an Auth0 client.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* var data = { name: 'newClientName' };
|
|
131
|
+
* var params = { client_id: CLIENT_ID };
|
|
132
|
+
*
|
|
133
|
+
* management.clients.update(params, data, function (err, client) {
|
|
134
|
+
* if (err) {
|
|
135
|
+
* // Handle error.
|
|
136
|
+
* }
|
|
137
|
+
*
|
|
138
|
+
* console.log(client.name); // 'newClientName'
|
|
139
|
+
* });
|
|
140
|
+
* @param {object} params Client parameters.
|
|
141
|
+
* @param {string} params.client_id Application client ID.
|
|
142
|
+
* @param {object} data Updated client data.
|
|
143
|
+
* @param {Function} [cb] Callback function.
|
|
144
|
+
* @returns {Promise|undefined}
|
|
145
|
+
*/
|
|
146
|
+
update(...args) {
|
|
147
|
+
return this.resource.patch(...args);
|
|
148
|
+
}
|
|
163
149
|
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*/
|
|
185
|
-
utils.wrapPropertyMethod(ClientsManager, 'delete', 'resource.delete');
|
|
150
|
+
/**
|
|
151
|
+
* Delete an Auth0 client.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* management.clients.delete({ client_id: CLIENT_ID }, function (err) {
|
|
155
|
+
* if (err) {
|
|
156
|
+
* // Handle error.
|
|
157
|
+
* }
|
|
158
|
+
*
|
|
159
|
+
* // Client deleted.
|
|
160
|
+
* });
|
|
161
|
+
* @param {object} params Client parameters.
|
|
162
|
+
* @param {string} params.client_id Application client ID.
|
|
163
|
+
* @param {Function} [cb] Callback function.
|
|
164
|
+
* @returns {Promise|undefined}
|
|
165
|
+
*/
|
|
166
|
+
delete(...args) {
|
|
167
|
+
return this.resource.delete(...args);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
186
170
|
|
|
187
171
|
module.exports = ClientsManager;
|