auth0 2.37.0 → 2.40.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 +37 -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 -583
- package/src/errors.js +23 -23
- package/src/index.js +3 -2
- package/src/management/ActionsManager.js +510 -584
- package/src/management/AttackProtectionManager.js +187 -0
- 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 -239
- 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 -784
- 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 +3102 -3625
- package/src/utils.js +31 -60
|
@@ -1,183 +1,161 @@
|
|
|
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
|
-
* Simple facade for consuming a REST API endpoint.
|
|
8
|
-
* @external RestClient
|
|
9
|
-
* @see https://github.com/ngonzalvez/rest-facade
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @class BrandingManager
|
|
14
6
|
* Manages settings related to branding.
|
|
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
7
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
class BrandingManager {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} options The client options.
|
|
11
|
+
* @param {string} options.baseUrl The URL of the API.
|
|
12
|
+
* @param {object} [options.headers] Headers to be included in all requests.
|
|
13
|
+
* @param {object} [options.retry] Retry Policy Config
|
|
14
|
+
*/
|
|
15
|
+
constructor(options) {
|
|
16
|
+
if (options === null || typeof options !== 'object') {
|
|
17
|
+
throw new ArgumentError('Must provide manager options');
|
|
18
|
+
}
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
if (options.baseUrl === null || options.baseUrl === undefined) {
|
|
21
|
+
throw new ArgumentError('Must provide a base URL for the API');
|
|
22
|
+
}
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
|
|
25
|
+
throw new ArgumentError('The provided base URL is invalid');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const clientOptions = {
|
|
29
|
+
errorFormatter: { message: 'message', name: 'error' },
|
|
30
|
+
headers: options.headers,
|
|
31
|
+
query: { repeatParams: false },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Provides an abstraction layer for consuming the
|
|
36
|
+
* {@link https://auth0.com/docs/api/management/v2#!/Branding Branding endpoint}.
|
|
37
|
+
*
|
|
38
|
+
* @type {external:RestClient}
|
|
39
|
+
*/
|
|
40
|
+
const auth0RestClient = new Auth0RestClient(
|
|
41
|
+
`${options.baseUrl}/branding`,
|
|
42
|
+
clientOptions,
|
|
43
|
+
options.tokenProvider
|
|
44
|
+
);
|
|
45
|
+
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Provides an abstraction layer for consuming the
|
|
49
|
+
* {@link https://auth0.com/docs/api/management/v2#!/Branding/get_universal_login Branding new universal login template endpoint}.
|
|
50
|
+
*
|
|
51
|
+
* @type {external:RestClient}
|
|
52
|
+
*/
|
|
53
|
+
const brandingTemplateAuth0RestClient = new Auth0RestClient(
|
|
54
|
+
`${options.baseUrl}/branding/templates/universal-login`,
|
|
55
|
+
clientOptions,
|
|
56
|
+
options.tokenProvider
|
|
57
|
+
);
|
|
58
|
+
this.brandingTemplates = new RetryRestClient(brandingTemplateAuth0RestClient, options.retry);
|
|
59
|
+
}
|
|
41
60
|
|
|
42
61
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
62
|
+
* Update the branding settings.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* management.branding.updateSettings(params, data, function (err, branding) {
|
|
66
|
+
* if (err) {
|
|
67
|
+
* // Handle error.
|
|
68
|
+
* }
|
|
45
69
|
*
|
|
46
|
-
*
|
|
70
|
+
* // Updated branding
|
|
71
|
+
* console.log(branding);
|
|
72
|
+
* });
|
|
73
|
+
* @param {object} params Branding parameters (leavy empty).
|
|
74
|
+
* @param {object} data Updated branding data.
|
|
75
|
+
* @param {Function} [cb] Callback function.
|
|
76
|
+
* @returns {Promise|undefined}
|
|
47
77
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
options.tokenProvider
|
|
52
|
-
);
|
|
53
|
-
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
78
|
+
updateSettings(...args) {
|
|
79
|
+
return this.resource.patch(...args);
|
|
80
|
+
}
|
|
54
81
|
|
|
55
82
|
/**
|
|
56
|
-
*
|
|
57
|
-
* {@link https://auth0.com/docs/api/management/v2#!/Branding/get_universal_login Branding new universal login template endpoint}.
|
|
83
|
+
* Get the branding settings..
|
|
58
84
|
*
|
|
59
|
-
* @
|
|
85
|
+
* @example
|
|
86
|
+
* management.branding.getSettings(data, function (err, branding) {
|
|
87
|
+
* if (err) {
|
|
88
|
+
* // Handle error.
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* // Branding
|
|
92
|
+
* console.log(branding);
|
|
93
|
+
* });
|
|
94
|
+
* @param {object} params Branding parameters.
|
|
95
|
+
* @param {object} data Branding data.
|
|
96
|
+
* @param {Function} [cb] Callback function.
|
|
97
|
+
* @returns {Promise|undefined}
|
|
60
98
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
options.tokenProvider
|
|
65
|
-
);
|
|
66
|
-
this.brandingTemplates = new RetryRestClient(brandingTemplateAuth0RestClient, options.retry);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Update the branding settings.
|
|
71
|
-
*
|
|
72
|
-
* @method updateSettings
|
|
73
|
-
* @memberOf module:management.BrandingManager.prototype
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* management.branding.updateSettings(params, data, function (err, branding) {
|
|
77
|
-
* if (err) {
|
|
78
|
-
* // Handle error.
|
|
79
|
-
* }
|
|
80
|
-
*
|
|
81
|
-
* // Updated branding
|
|
82
|
-
* console.log(branding);
|
|
83
|
-
* });
|
|
84
|
-
*
|
|
85
|
-
* @param {Object} params Branding parameters (leavy empty).
|
|
86
|
-
* @param {Object} data Updated branding data.
|
|
87
|
-
* @param {Function} [cb] Callback function.
|
|
88
|
-
*
|
|
89
|
-
* @return {Promise|undefined}
|
|
90
|
-
*/
|
|
91
|
-
utils.wrapPropertyMethod(BrandingManager, 'updateSettings', 'resource.patch');
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get the branding settings..
|
|
95
|
-
*
|
|
96
|
-
* @method getSettings
|
|
97
|
-
* @memberOf module:management.BrandingManager.prototype
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* management.branding.getSettings(data, function (err, branding) {
|
|
101
|
-
* if (err) {
|
|
102
|
-
* // Handle error.
|
|
103
|
-
* }
|
|
104
|
-
*
|
|
105
|
-
* // Branding
|
|
106
|
-
* console.log(branding);
|
|
107
|
-
* });
|
|
108
|
-
*
|
|
109
|
-
* @param {Object} params Branding parameters.
|
|
110
|
-
* @param {Object} data Branding data.
|
|
111
|
-
* @param {Function} [cb] Callback function.
|
|
112
|
-
*
|
|
113
|
-
* @return {Promise|undefined}
|
|
114
|
-
*/
|
|
115
|
-
utils.wrapPropertyMethod(BrandingManager, 'getSettings', 'resource.get');
|
|
99
|
+
getSettings(...args) {
|
|
100
|
+
return this.resource.get(...args);
|
|
101
|
+
}
|
|
116
102
|
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
* @return {Promise|undefined}
|
|
138
|
-
*/
|
|
139
|
-
utils.wrapPropertyMethod(BrandingManager, 'getUniversalLoginTemplate', 'brandingTemplates.get');
|
|
103
|
+
/**
|
|
104
|
+
* Get the new universal login template.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* management.branding.getUniversalLoginTemplate(data, function (err, template) {
|
|
108
|
+
* if (err) {
|
|
109
|
+
* // Handle error.
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
112
|
+
* // Branding
|
|
113
|
+
* console.log(template);
|
|
114
|
+
* });
|
|
115
|
+
* @param {object} params Branding parameters (leave empty).
|
|
116
|
+
* @param {object} data Branding data (leave empty).
|
|
117
|
+
* @param {Function} [cb] Callback function.
|
|
118
|
+
* @returns {Promise|undefined}
|
|
119
|
+
*/
|
|
120
|
+
getUniversalLoginTemplate(...args) {
|
|
121
|
+
return this.brandingTemplates.get(...args);
|
|
122
|
+
}
|
|
140
123
|
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* @return {Promise|undefined}
|
|
159
|
-
*/
|
|
160
|
-
utils.wrapPropertyMethod(BrandingManager, 'setUniversalLoginTemplate', 'brandingTemplates.update');
|
|
124
|
+
/**
|
|
125
|
+
* Set the new universal login template.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* management.branding.setUniversalLoginTemplate(params, data, function (err) {
|
|
129
|
+
* if (err) {
|
|
130
|
+
* // Handle error.
|
|
131
|
+
* }
|
|
132
|
+
* });
|
|
133
|
+
* @param {object} params Branding parameters (leavy empty).
|
|
134
|
+
* @param {object} data Branding data (object with template field).
|
|
135
|
+
* @param {Function} [cb] Callback function.
|
|
136
|
+
* @returns {Promise|undefined}
|
|
137
|
+
*/
|
|
138
|
+
setUniversalLoginTemplate(...args) {
|
|
139
|
+
return this.brandingTemplates.update(...args);
|
|
140
|
+
}
|
|
161
141
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*/
|
|
181
|
-
utils.wrapPropertyMethod(BrandingManager, 'deleteUniversalLoginTemplate', 'brandingTemplates.delete');
|
|
142
|
+
/**
|
|
143
|
+
* Delete the new universal login template (revert to default).
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* management.branding.deleteUniversalLoginTemplate(data, function (err) {
|
|
147
|
+
* if (err) {
|
|
148
|
+
* // Handle error.
|
|
149
|
+
* }
|
|
150
|
+
* });
|
|
151
|
+
* @param {object} params Branding parameters (leavy empty).
|
|
152
|
+
* @param {object} data Branding data (leave empty).
|
|
153
|
+
* @param {Function} [cb] Callback function.
|
|
154
|
+
* @returns {Promise|undefined}
|
|
155
|
+
*/
|
|
156
|
+
deleteUniversalLoginTemplate(...args) {
|
|
157
|
+
return this.brandingTemplates.delete(...args);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
182
160
|
|
|
183
161
|
module.exports = BrandingManager;
|
|
@@ -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;
|