@fusionauth/typescript-client 1.61.0 → 1.62.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/build/src/FusionAuthClient.d.ts +416 -3
- package/build/src/FusionAuthClient.js +496 -1
- package/build/src/FusionAuthClient.js.map +1 -1
- package/dist/fusionauth-typescript-client.js +497 -2
- package/dist/fusionauth-typescript-client.min.js +1 -1
- package/dist/fusionauth-typescript-client.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* language governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.WebhookEventResult = exports.WebhookAttemptResult = exports.WebAuthnWorkflow = exports.VerificationStrategy = exports.UserVerificationRequirement = exports.UserState = exports.UserActionPhase = exports.UnverifiedBehavior = exports.UnknownScopePolicy = exports.TransactionType = exports.TokenType = exports.ThemeType = exports.UniqueUsernameStrategy = exports.SystemTrustedProxyConfigurationPolicy = exports.SteamAPIMode = exports.Sort = exports.SendSetPasswordIdentityType = exports.SecureGeneratorType = exports.SAMLv2DestinationAssertionPolicy = exports.ResidentKeyRequirement = exports.RefreshTokenUsagePolicy = exports.RefreshTokenExpirationPolicy = exports.ReactorFeatureStatus = exports.PublicKeyCredentialType = exports.ProofKeyForCodeExchangePolicy = exports.PasswordlessStrategy = exports.BreachMatchMode = exports.BreachAction = exports.ObjectState = exports.Oauth2AuthorizedURLValidationPolicy = exports.OAuthScopeHandlingPolicy = exports.OAuthScopeConsentMode = exports.OAuthErrorType = exports.OAuthErrorReason = exports.OAuthApplicationRelationship = exports.MultiFactorLoginPolicy = exports.MessengerType = exports.MessageType = exports.LogoutBehavior = exports.LambdaType = exports.LambdaEngineType = exports.LDAPSecurityMethod = exports.KeyUse = exports.KeyType = exports.KeyAlgorithm = exports.IdentityVerifiedReason = exports.IdentityProviderType = exports.ClientAuthenticationMethod = exports.IdentityProviderLoginMethod = exports.IdentityProviderLinkingStrategy = exports.IPAccessControlEntryAction = exports.HTTPMethod = exports.GrantType = exports.FormType = exports.FormFieldAdminPolicy = exports.FormDataType = exports.FormControl = exports.FamilyRole = exports.ExpiryUnit = exports.EventType = exports.EventLogType = exports.EmailSecurityType = exports.DeviceType = exports.CoseKeyType = exports.CoseEllipticCurve = exports.CoseAlgorithmIdentifier = exports.ContentStatus = exports.ConsentStatus = exports.ConnectorType = exports.ClientAuthenticationPolicy = exports.ChangePasswordReason = exports.CaptchaMethod = exports.CanonicalizationMethod = exports.BreachedPasswordStatus = exports.TOTPAlgorithm = exports.AuthenticatorAttachmentPreference = exports.AuthenticatorAttachment = exports.AuthenticationThreats = exports.AttestationType = exports.AttestationConveyancePreference = exports.ApplicationMultiFactorTrustPolicy = exports.XMLSignatureLocation = exports.SAMLLogoutBehavior = exports.RegistrationType = exports.LoginIdType = exports.Algorithm = exports.FusionAuthClient = void 0;
|
|
18
|
+
exports.WebhookEventResult = exports.WebhookAttemptResult = exports.WebAuthnWorkflow = exports.VerificationStrategy = exports.UserVerificationRequirement = exports.UserState = exports.UserActionPhase = exports.UnverifiedBehavior = exports.UnknownScopePolicy = exports.TransactionType = exports.TokenType = exports.ThemeType = exports.UniqueUsernameStrategy = exports.SystemTrustedProxyConfigurationPolicy = exports.SteamAPIMode = exports.Sort = exports.SendSetPasswordIdentityType = exports.SecureGeneratorType = exports.SAMLv2DestinationAssertionPolicy = exports.ResidentKeyRequirement = exports.RefreshTokenUsagePolicy = exports.RefreshTokenExpirationPolicy = exports.ReactorFeatureStatus = exports.PublicKeyCredentialType = exports.ProofKeyForCodeExchangePolicy = exports.PasswordlessStrategy = exports.BreachMatchMode = exports.BreachAction = exports.ObjectState = exports.Oauth2AuthorizedURLValidationPolicy = exports.OAuthScopeHandlingPolicy = exports.OAuthScopeConsentMode = exports.OAuthErrorType = exports.OAuthErrorReason = exports.OAuthApplicationRelationship = exports.MultiFactorLoginPolicy = exports.MultiFactorAction = exports.MessengerType = exports.MessageType = exports.LogoutBehavior = exports.LambdaType = exports.LambdaEngineType = exports.LDAPSecurityMethod = exports.KeyUse = exports.KeyType = exports.KeyAlgorithm = exports.IdentityVerifiedReason = exports.IdentityProviderType = exports.ClientAuthenticationMethod = exports.IdentityProviderLoginMethod = exports.IdentityProviderLinkingStrategy = exports.IPAccessControlEntryAction = exports.HTTPMethod = exports.GrantType = exports.FormType = exports.FormStepType = exports.FormFieldAdminPolicy = exports.FormDataType = exports.FormControl = exports.FamilyRole = exports.ExpiryUnit = exports.ExistingUserStrategy = exports.EventType = exports.EventLogType = exports.EmailSecurityType = exports.DeviceType = exports.CoseKeyType = exports.CoseEllipticCurve = exports.CoseAlgorithmIdentifier = exports.ContentStatus = exports.ConsentStatus = exports.ConnectorType = exports.ClientAuthenticationPolicy = exports.ChangePasswordReason = exports.CaptchaMethod = exports.CanonicalizationMethod = exports.BreachedPasswordStatus = exports.TOTPAlgorithm = exports.AuthenticatorAttachmentPreference = exports.AuthenticatorAttachment = exports.AuthenticationThreats = exports.AttestationType = exports.AttestationConveyancePreference = exports.ApplicationMultiFactorTrustPolicy = exports.XMLSignatureLocation = exports.SAMLLogoutBehavior = exports.RegistrationType = exports.LoginIdType = exports.Algorithm = exports.FusionAuthClient = void 0;
|
|
19
19
|
const DefaultRESTClientBuilder_1 = require("./DefaultRESTClientBuilder");
|
|
20
20
|
const url_1 = require("url");
|
|
21
21
|
class FusionAuthClient {
|
|
@@ -109,6 +109,35 @@ class FusionAuthClient {
|
|
|
109
109
|
.withMethod("POST")
|
|
110
110
|
.go();
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Approve a device grant.
|
|
114
|
+
*
|
|
115
|
+
* @param {DeviceApprovalRequest} request The request object containing the device approval information and optional tenantId.
|
|
116
|
+
* @returns {Promise<ClientResponse<DeviceApprovalResponse>>}
|
|
117
|
+
*/
|
|
118
|
+
approveDeviceWithRequest(request) {
|
|
119
|
+
let body = new url_1.URLSearchParams();
|
|
120
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
121
|
+
body.append('client_id', request.client_id);
|
|
122
|
+
}
|
|
123
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
124
|
+
body.append('client_secret', request.client_secret);
|
|
125
|
+
}
|
|
126
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
127
|
+
body.append('tenantId', request.tenantId.toString());
|
|
128
|
+
}
|
|
129
|
+
if (request.token !== null && request.token !== undefined) {
|
|
130
|
+
body.append('token', request.token);
|
|
131
|
+
}
|
|
132
|
+
if (request.user_code !== null && request.user_code !== undefined) {
|
|
133
|
+
body.append('user_code', request.user_code);
|
|
134
|
+
}
|
|
135
|
+
return this.start()
|
|
136
|
+
.withUri('/oauth2/device/approve')
|
|
137
|
+
.withFormData(body)
|
|
138
|
+
.withMethod("POST")
|
|
139
|
+
.go();
|
|
140
|
+
}
|
|
112
141
|
/**
|
|
113
142
|
* Cancels the user action.
|
|
114
143
|
*
|
|
@@ -213,6 +242,25 @@ class FusionAuthClient {
|
|
|
213
242
|
.withMethod("GET")
|
|
214
243
|
.go();
|
|
215
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
247
|
+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
248
|
+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
|
|
249
|
+
*
|
|
250
|
+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
251
|
+
*
|
|
252
|
+
* @param {string} changePasswordId The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
|
|
253
|
+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
254
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
255
|
+
*/
|
|
256
|
+
checkChangePasswordUsingIdAndIPAddress(changePasswordId, ipAddress) {
|
|
257
|
+
return this.startAnonymous()
|
|
258
|
+
.withUri('/api/user/change-password')
|
|
259
|
+
.withUriSegment(changePasswordId)
|
|
260
|
+
.withParameter('ipAddress', ipAddress)
|
|
261
|
+
.withMethod("GET")
|
|
262
|
+
.go();
|
|
263
|
+
}
|
|
216
264
|
/**
|
|
217
265
|
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
218
266
|
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -230,6 +278,25 @@ class FusionAuthClient {
|
|
|
230
278
|
.withMethod("GET")
|
|
231
279
|
.go();
|
|
232
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
283
|
+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
284
|
+
* your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
|
|
285
|
+
*
|
|
286
|
+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} encodedJWT The encoded JWT (access token).
|
|
289
|
+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
290
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
291
|
+
*/
|
|
292
|
+
checkChangePasswordUsingJWTAndIPAddress(encodedJWT, ipAddress) {
|
|
293
|
+
return this.startAnonymous()
|
|
294
|
+
.withUri('/api/user/change-password')
|
|
295
|
+
.withAuthorization('Bearer ' + encodedJWT)
|
|
296
|
+
.withParameter('ipAddress', ipAddress)
|
|
297
|
+
.withMethod("GET")
|
|
298
|
+
.go();
|
|
299
|
+
}
|
|
233
300
|
/**
|
|
234
301
|
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
235
302
|
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -247,6 +314,25 @@ class FusionAuthClient {
|
|
|
247
314
|
.withMethod("GET")
|
|
248
315
|
.go();
|
|
249
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
319
|
+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
320
|
+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
|
|
321
|
+
*
|
|
322
|
+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
323
|
+
*
|
|
324
|
+
* @param {string} loginId The loginId (email or username) of the User that you intend to change the password for.
|
|
325
|
+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
326
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
327
|
+
*/
|
|
328
|
+
checkChangePasswordUsingLoginIdAndIPAddress(loginId, ipAddress) {
|
|
329
|
+
return this.start()
|
|
330
|
+
.withUri('/api/user/change-password')
|
|
331
|
+
.withParameter('loginId', loginId)
|
|
332
|
+
.withParameter('ipAddress', ipAddress)
|
|
333
|
+
.withMethod("GET")
|
|
334
|
+
.go();
|
|
335
|
+
}
|
|
250
336
|
/**
|
|
251
337
|
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
252
338
|
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -266,6 +352,27 @@ class FusionAuthClient {
|
|
|
266
352
|
.withMethod("GET")
|
|
267
353
|
.go();
|
|
268
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
357
|
+
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
358
|
+
* your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
|
|
359
|
+
*
|
|
360
|
+
* An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
361
|
+
*
|
|
362
|
+
* @param {string} loginId The loginId of the User that you intend to change the password for.
|
|
363
|
+
* @param {Array<String>} loginIdTypes The identity types that FusionAuth will compare the loginId to.
|
|
364
|
+
* @param {string} ipAddress (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
365
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
366
|
+
*/
|
|
367
|
+
checkChangePasswordUsingLoginIdAndLoginIdTypesAndIPAddress(loginId, loginIdTypes, ipAddress) {
|
|
368
|
+
return this.start()
|
|
369
|
+
.withUri('/api/user/change-password')
|
|
370
|
+
.withParameter('loginId', loginId)
|
|
371
|
+
.withParameter('loginIdTypes', loginIdTypes)
|
|
372
|
+
.withParameter('ipAddress', ipAddress)
|
|
373
|
+
.withMethod("GET")
|
|
374
|
+
.go();
|
|
375
|
+
}
|
|
269
376
|
/**
|
|
270
377
|
* Make a Client Credentials grant request to obtain an access token.
|
|
271
378
|
*
|
|
@@ -288,6 +395,35 @@ class FusionAuthClient {
|
|
|
288
395
|
.withMethod("POST")
|
|
289
396
|
.go();
|
|
290
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Make a Client Credentials grant request to obtain an access token.
|
|
400
|
+
*
|
|
401
|
+
* @param {ClientCredentialsGrantRequest} request The client credentials grant request containing client authentication, scope and optional tenantId.
|
|
402
|
+
* @returns {Promise<ClientResponse<AccessToken>>}
|
|
403
|
+
*/
|
|
404
|
+
clientCredentialsGrantWithRequest(request) {
|
|
405
|
+
let body = new url_1.URLSearchParams();
|
|
406
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
407
|
+
body.append('client_id', request.client_id);
|
|
408
|
+
}
|
|
409
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
410
|
+
body.append('client_secret', request.client_secret);
|
|
411
|
+
}
|
|
412
|
+
if (request.grant_type !== null && request.grant_type !== undefined) {
|
|
413
|
+
body.append('grant_type', request.grant_type);
|
|
414
|
+
}
|
|
415
|
+
if (request.scope !== null && request.scope !== undefined) {
|
|
416
|
+
body.append('scope', request.scope);
|
|
417
|
+
}
|
|
418
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
419
|
+
body.append('tenantId', request.tenantId);
|
|
420
|
+
}
|
|
421
|
+
return this.startAnonymous()
|
|
422
|
+
.withUri('/oauth2/token')
|
|
423
|
+
.withFormData(body)
|
|
424
|
+
.withMethod("POST")
|
|
425
|
+
.go();
|
|
426
|
+
}
|
|
291
427
|
/**
|
|
292
428
|
* Adds a comment to the user's account.
|
|
293
429
|
*
|
|
@@ -1407,6 +1543,51 @@ class FusionAuthClient {
|
|
|
1407
1543
|
.withMethod("DELETE")
|
|
1408
1544
|
.go();
|
|
1409
1545
|
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Start the Device Authorization flow using form-encoded parameters
|
|
1548
|
+
*
|
|
1549
|
+
* @param {string} client_id The unique client identifier. The client Id is the Id of the FusionAuth Application in which you are attempting to authenticate.
|
|
1550
|
+
* @param {string} client_secret (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.
|
|
1551
|
+
* @param {string} scope (Optional) A space-delimited string of the requested scopes. Defaults to all scopes configured in the Application's OAuth configuration.
|
|
1552
|
+
* @returns {Promise<ClientResponse<DeviceResponse>>}
|
|
1553
|
+
*/
|
|
1554
|
+
deviceAuthorize(client_id, client_secret, scope) {
|
|
1555
|
+
let body = new url_1.URLSearchParams();
|
|
1556
|
+
body.append('client_id', client_id);
|
|
1557
|
+
body.append('client_secret', client_secret);
|
|
1558
|
+
body.append('scope', scope);
|
|
1559
|
+
return this.startAnonymous()
|
|
1560
|
+
.withUri('/oauth2/device_authorize')
|
|
1561
|
+
.withFormData(body)
|
|
1562
|
+
.withMethod("POST")
|
|
1563
|
+
.go();
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Start the Device Authorization flow using a request body
|
|
1567
|
+
*
|
|
1568
|
+
* @param {DeviceAuthorizationRequest} request The device authorization request containing client authentication, scope, and optional device metadata.
|
|
1569
|
+
* @returns {Promise<ClientResponse<DeviceResponse>>}
|
|
1570
|
+
*/
|
|
1571
|
+
deviceAuthorizeWithRequest(request) {
|
|
1572
|
+
let body = new url_1.URLSearchParams();
|
|
1573
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
1574
|
+
body.append('client_id', request.client_id);
|
|
1575
|
+
}
|
|
1576
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
1577
|
+
body.append('client_secret', request.client_secret);
|
|
1578
|
+
}
|
|
1579
|
+
if (request.scope !== null && request.scope !== undefined) {
|
|
1580
|
+
body.append('scope', request.scope);
|
|
1581
|
+
}
|
|
1582
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
1583
|
+
body.append('tenantId', request.tenantId.toString());
|
|
1584
|
+
}
|
|
1585
|
+
return this.startAnonymous()
|
|
1586
|
+
.withUri('/oauth2/device_authorize')
|
|
1587
|
+
.withFormData(body)
|
|
1588
|
+
.withMethod("POST")
|
|
1589
|
+
.go();
|
|
1590
|
+
}
|
|
1410
1591
|
/**
|
|
1411
1592
|
* Disable two-factor authentication for a user.
|
|
1412
1593
|
*
|
|
@@ -1504,6 +1685,75 @@ class FusionAuthClient {
|
|
|
1504
1685
|
.withMethod("POST")
|
|
1505
1686
|
.go();
|
|
1506
1687
|
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Exchanges an OAuth authorization code and code_verifier for an access token.
|
|
1690
|
+
* Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint and a code_verifier for an access token.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {OAuthCodePKCEAccessTokenRequest} request The PKCE OAuth code access token exchange request.
|
|
1693
|
+
* @returns {Promise<ClientResponse<AccessToken>>}
|
|
1694
|
+
*/
|
|
1695
|
+
exchangeOAuthCodeForAccessTokenUsingPKCEWithRequest(request) {
|
|
1696
|
+
let body = new url_1.URLSearchParams();
|
|
1697
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
1698
|
+
body.append('client_id', request.client_id);
|
|
1699
|
+
}
|
|
1700
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
1701
|
+
body.append('client_secret', request.client_secret);
|
|
1702
|
+
}
|
|
1703
|
+
if (request.code !== null && request.code !== undefined) {
|
|
1704
|
+
body.append('code', request.code);
|
|
1705
|
+
}
|
|
1706
|
+
if (request.code_verifier !== null && request.code_verifier !== undefined) {
|
|
1707
|
+
body.append('code_verifier', request.code_verifier);
|
|
1708
|
+
}
|
|
1709
|
+
if (request.grant_type !== null && request.grant_type !== undefined) {
|
|
1710
|
+
body.append('grant_type', request.grant_type);
|
|
1711
|
+
}
|
|
1712
|
+
if (request.redirect_uri !== null && request.redirect_uri !== undefined) {
|
|
1713
|
+
body.append('redirect_uri', request.redirect_uri);
|
|
1714
|
+
}
|
|
1715
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
1716
|
+
body.append('tenantId', request.tenantId.toString());
|
|
1717
|
+
}
|
|
1718
|
+
return this.startAnonymous()
|
|
1719
|
+
.withUri('/oauth2/token')
|
|
1720
|
+
.withFormData(body)
|
|
1721
|
+
.withMethod("POST")
|
|
1722
|
+
.go();
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Exchanges an OAuth authorization code for an access token.
|
|
1726
|
+
* Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.
|
|
1727
|
+
*
|
|
1728
|
+
* @param {OAuthCodeAccessTokenRequest} request The OAuth code access token exchange request.
|
|
1729
|
+
* @returns {Promise<ClientResponse<AccessToken>>}
|
|
1730
|
+
*/
|
|
1731
|
+
exchangeOAuthCodeForAccessTokenWithRequest(request) {
|
|
1732
|
+
let body = new url_1.URLSearchParams();
|
|
1733
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
1734
|
+
body.append('client_id', request.client_id);
|
|
1735
|
+
}
|
|
1736
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
1737
|
+
body.append('client_secret', request.client_secret);
|
|
1738
|
+
}
|
|
1739
|
+
if (request.code !== null && request.code !== undefined) {
|
|
1740
|
+
body.append('code', request.code);
|
|
1741
|
+
}
|
|
1742
|
+
if (request.grant_type !== null && request.grant_type !== undefined) {
|
|
1743
|
+
body.append('grant_type', request.grant_type);
|
|
1744
|
+
}
|
|
1745
|
+
if (request.redirect_uri !== null && request.redirect_uri !== undefined) {
|
|
1746
|
+
body.append('redirect_uri', request.redirect_uri);
|
|
1747
|
+
}
|
|
1748
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
1749
|
+
body.append('tenantId', request.tenantId);
|
|
1750
|
+
}
|
|
1751
|
+
return this.startAnonymous()
|
|
1752
|
+
.withUri('/oauth2/token')
|
|
1753
|
+
.withFormData(body)
|
|
1754
|
+
.withMethod("POST")
|
|
1755
|
+
.go();
|
|
1756
|
+
}
|
|
1507
1757
|
/**
|
|
1508
1758
|
* Exchange a Refresh Token for an Access Token.
|
|
1509
1759
|
* If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.
|
|
@@ -1530,6 +1780,42 @@ class FusionAuthClient {
|
|
|
1530
1780
|
.withMethod("POST")
|
|
1531
1781
|
.go();
|
|
1532
1782
|
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Exchange a Refresh Token for an Access Token.
|
|
1785
|
+
* If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.
|
|
1786
|
+
*
|
|
1787
|
+
* @param {RefreshTokenAccessTokenRequest} request The refresh token access token exchange request.
|
|
1788
|
+
* @returns {Promise<ClientResponse<AccessToken>>}
|
|
1789
|
+
*/
|
|
1790
|
+
exchangeRefreshTokenForAccessTokenWithRequest(request) {
|
|
1791
|
+
let body = new url_1.URLSearchParams();
|
|
1792
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
1793
|
+
body.append('client_id', request.client_id);
|
|
1794
|
+
}
|
|
1795
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
1796
|
+
body.append('client_secret', request.client_secret);
|
|
1797
|
+
}
|
|
1798
|
+
if (request.grant_type !== null && request.grant_type !== undefined) {
|
|
1799
|
+
body.append('grant_type', request.grant_type);
|
|
1800
|
+
}
|
|
1801
|
+
if (request.refresh_token !== null && request.refresh_token !== undefined) {
|
|
1802
|
+
body.append('refresh_token', request.refresh_token);
|
|
1803
|
+
}
|
|
1804
|
+
if (request.scope !== null && request.scope !== undefined) {
|
|
1805
|
+
body.append('scope', request.scope);
|
|
1806
|
+
}
|
|
1807
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
1808
|
+
body.append('tenantId', request.tenantId.toString());
|
|
1809
|
+
}
|
|
1810
|
+
if (request.user_code !== null && request.user_code !== undefined) {
|
|
1811
|
+
body.append('user_code', request.user_code);
|
|
1812
|
+
}
|
|
1813
|
+
return this.startAnonymous()
|
|
1814
|
+
.withUri('/oauth2/token')
|
|
1815
|
+
.withFormData(body)
|
|
1816
|
+
.withMethod("POST")
|
|
1817
|
+
.go();
|
|
1818
|
+
}
|
|
1533
1819
|
/**
|
|
1534
1820
|
* Exchange a refresh token for a new JWT.
|
|
1535
1821
|
*
|
|
@@ -1571,6 +1857,45 @@ class FusionAuthClient {
|
|
|
1571
1857
|
.withMethod("POST")
|
|
1572
1858
|
.go();
|
|
1573
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Exchange User Credentials for a Token.
|
|
1862
|
+
* If you will be using the Resource Owner Password Credential Grant, you will make a request to the Token endpoint to exchange the user’s email and password for an access token.
|
|
1863
|
+
*
|
|
1864
|
+
* @param {UserCredentialsAccessTokenRequest} request The user credentials access token exchange request.
|
|
1865
|
+
* @returns {Promise<ClientResponse<AccessToken>>}
|
|
1866
|
+
*/
|
|
1867
|
+
exchangeUserCredentialsForAccessTokenWithRequest(request) {
|
|
1868
|
+
let body = new url_1.URLSearchParams();
|
|
1869
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
1870
|
+
body.append('client_id', request.client_id);
|
|
1871
|
+
}
|
|
1872
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
1873
|
+
body.append('client_secret', request.client_secret);
|
|
1874
|
+
}
|
|
1875
|
+
if (request.grant_type !== null && request.grant_type !== undefined) {
|
|
1876
|
+
body.append('grant_type', request.grant_type);
|
|
1877
|
+
}
|
|
1878
|
+
if (request.password !== null && request.password !== undefined) {
|
|
1879
|
+
body.append('password', request.password);
|
|
1880
|
+
}
|
|
1881
|
+
if (request.scope !== null && request.scope !== undefined) {
|
|
1882
|
+
body.append('scope', request.scope);
|
|
1883
|
+
}
|
|
1884
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
1885
|
+
body.append('tenantId', request.tenantId);
|
|
1886
|
+
}
|
|
1887
|
+
if (request.user_code !== null && request.user_code !== undefined) {
|
|
1888
|
+
body.append('user_code', request.user_code);
|
|
1889
|
+
}
|
|
1890
|
+
if (request.username !== null && request.username !== undefined) {
|
|
1891
|
+
body.append('username', request.username);
|
|
1892
|
+
}
|
|
1893
|
+
return this.startAnonymous()
|
|
1894
|
+
.withUri('/oauth2/token')
|
|
1895
|
+
.withFormData(body)
|
|
1896
|
+
.withMethod("POST")
|
|
1897
|
+
.go();
|
|
1898
|
+
}
|
|
1574
1899
|
/**
|
|
1575
1900
|
* Begins the forgot password sequence, which kicks off an email to the user so that they can reset their password.
|
|
1576
1901
|
*
|
|
@@ -1773,6 +2098,29 @@ class FusionAuthClient {
|
|
|
1773
2098
|
.withMethod("POST")
|
|
1774
2099
|
.go();
|
|
1775
2100
|
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Inspect an access token issued as the result of the User based grant such as the Authorization Code Grant, Implicit Grant, the User Credentials Grant or the Refresh Grant.
|
|
2103
|
+
*
|
|
2104
|
+
* @param {AccessTokenIntrospectRequest} request The access token introspection request.
|
|
2105
|
+
* @returns {Promise<ClientResponse<IntrospectResponse>>}
|
|
2106
|
+
*/
|
|
2107
|
+
introspectAccessTokenWithRequest(request) {
|
|
2108
|
+
let body = new url_1.URLSearchParams();
|
|
2109
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
2110
|
+
body.append('client_id', request.client_id);
|
|
2111
|
+
}
|
|
2112
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
2113
|
+
body.append('tenantId', request.tenantId);
|
|
2114
|
+
}
|
|
2115
|
+
if (request.token !== null && request.token !== undefined) {
|
|
2116
|
+
body.append('token', request.token);
|
|
2117
|
+
}
|
|
2118
|
+
return this.startAnonymous()
|
|
2119
|
+
.withUri('/oauth2/introspect')
|
|
2120
|
+
.withFormData(body)
|
|
2121
|
+
.withMethod("POST")
|
|
2122
|
+
.go();
|
|
2123
|
+
}
|
|
1776
2124
|
/**
|
|
1777
2125
|
* Inspect an access token issued as the result of the Client Credentials Grant.
|
|
1778
2126
|
*
|
|
@@ -1788,6 +2136,26 @@ class FusionAuthClient {
|
|
|
1788
2136
|
.withMethod("POST")
|
|
1789
2137
|
.go();
|
|
1790
2138
|
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Inspect an access token issued as the result of the Client Credentials Grant.
|
|
2141
|
+
*
|
|
2142
|
+
* @param {ClientCredentialsAccessTokenIntrospectRequest} request The client credentials access token.
|
|
2143
|
+
* @returns {Promise<ClientResponse<IntrospectResponse>>}
|
|
2144
|
+
*/
|
|
2145
|
+
introspectClientCredentialsAccessTokenWithRequest(request) {
|
|
2146
|
+
let body = new url_1.URLSearchParams();
|
|
2147
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
2148
|
+
body.append('tenantId', request.tenantId);
|
|
2149
|
+
}
|
|
2150
|
+
if (request.token !== null && request.token !== undefined) {
|
|
2151
|
+
body.append('token', request.token);
|
|
2152
|
+
}
|
|
2153
|
+
return this.startAnonymous()
|
|
2154
|
+
.withUri('/oauth2/introspect')
|
|
2155
|
+
.withFormData(body)
|
|
2156
|
+
.withMethod("POST")
|
|
2157
|
+
.go();
|
|
2158
|
+
}
|
|
1791
2159
|
/**
|
|
1792
2160
|
* Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid
|
|
1793
2161
|
* access token is properly signed and not expired.
|
|
@@ -3549,6 +3917,19 @@ class FusionAuthClient {
|
|
|
3549
3917
|
.withMethod("GET")
|
|
3550
3918
|
.go();
|
|
3551
3919
|
}
|
|
3920
|
+
/**
|
|
3921
|
+
* Retrieves the totals report. This allows excluding applicationTotals from the report. An empty list will include the applicationTotals.
|
|
3922
|
+
*
|
|
3923
|
+
* @param {Array<String>} excludes List of fields to exclude in the response. Currently only allows applicationTotals.
|
|
3924
|
+
* @returns {Promise<ClientResponse<TotalsReportResponse>>}
|
|
3925
|
+
*/
|
|
3926
|
+
retrieveTotalReportWithExcludes(excludes) {
|
|
3927
|
+
return this.start()
|
|
3928
|
+
.withUri('/api/report/totals')
|
|
3929
|
+
.withParameter('excludes', excludes)
|
|
3930
|
+
.withMethod("GET")
|
|
3931
|
+
.go();
|
|
3932
|
+
}
|
|
3552
3933
|
/**
|
|
3553
3934
|
* Retrieve two-factor recovery codes for a user.
|
|
3554
3935
|
*
|
|
@@ -3582,6 +3963,23 @@ class FusionAuthClient {
|
|
|
3582
3963
|
.withMethod("GET")
|
|
3583
3964
|
.go();
|
|
3584
3965
|
}
|
|
3966
|
+
/**
|
|
3967
|
+
* Retrieve a user's two-factor status.
|
|
3968
|
+
*
|
|
3969
|
+
* This can be used to see if a user will need to complete a two-factor challenge to complete a login,
|
|
3970
|
+
* and optionally identify the state of the two-factor trust across various applications. This operation
|
|
3971
|
+
* provides more payload options than retrieveTwoFactorStatus.
|
|
3972
|
+
*
|
|
3973
|
+
* @param {TwoFactorStatusRequest} request The request object that contains all the information used to check the status.
|
|
3974
|
+
* @returns {Promise<ClientResponse<TwoFactorStatusResponse>>}
|
|
3975
|
+
*/
|
|
3976
|
+
retrieveTwoFactorStatusWithRequest(request) {
|
|
3977
|
+
return this.start()
|
|
3978
|
+
.withUri('/api/two-factor/status')
|
|
3979
|
+
.withJSONBody(request)
|
|
3980
|
+
.withMethod("POST")
|
|
3981
|
+
.go();
|
|
3982
|
+
}
|
|
3585
3983
|
/**
|
|
3586
3984
|
* Retrieves the user for the given Id.
|
|
3587
3985
|
*
|
|
@@ -3767,6 +4165,58 @@ class FusionAuthClient {
|
|
|
3767
4165
|
.withMethod("GET")
|
|
3768
4166
|
.go();
|
|
3769
4167
|
}
|
|
4168
|
+
/**
|
|
4169
|
+
* Retrieve a user_code that is part of an in-progress Device Authorization Grant.
|
|
4170
|
+
*
|
|
4171
|
+
* This API is useful if you want to build your own login workflow to complete a device grant.
|
|
4172
|
+
*
|
|
4173
|
+
* This request will require an API key.
|
|
4174
|
+
*
|
|
4175
|
+
* @param {RetrieveUserCodeUsingAPIKeyRequest} request The user code retrieval request including optional tenantId.
|
|
4176
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
4177
|
+
*/
|
|
4178
|
+
retrieveUserCodeUsingAPIKeyWithRequest(request) {
|
|
4179
|
+
let body = new url_1.URLSearchParams();
|
|
4180
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
4181
|
+
body.append('tenantId', request.tenantId.toString());
|
|
4182
|
+
}
|
|
4183
|
+
if (request.user_code !== null && request.user_code !== undefined) {
|
|
4184
|
+
body.append('user_code', request.user_code);
|
|
4185
|
+
}
|
|
4186
|
+
return this.startAnonymous()
|
|
4187
|
+
.withUri('/oauth2/device/user-code')
|
|
4188
|
+
.withFormData(body)
|
|
4189
|
+
.withMethod("POST")
|
|
4190
|
+
.go();
|
|
4191
|
+
}
|
|
4192
|
+
/**
|
|
4193
|
+
* Retrieve a user_code that is part of an in-progress Device Authorization Grant.
|
|
4194
|
+
*
|
|
4195
|
+
* This API is useful if you want to build your own login workflow to complete a device grant.
|
|
4196
|
+
*
|
|
4197
|
+
* @param {RetrieveUserCodeRequest} request The user code retrieval request.
|
|
4198
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
4199
|
+
*/
|
|
4200
|
+
retrieveUserCodeWithRequest(request) {
|
|
4201
|
+
let body = new url_1.URLSearchParams();
|
|
4202
|
+
if (request.client_id !== null && request.client_id !== undefined) {
|
|
4203
|
+
body.append('client_id', request.client_id);
|
|
4204
|
+
}
|
|
4205
|
+
if (request.client_secret !== null && request.client_secret !== undefined) {
|
|
4206
|
+
body.append('client_secret', request.client_secret);
|
|
4207
|
+
}
|
|
4208
|
+
if (request.tenantId !== null && request.tenantId !== undefined) {
|
|
4209
|
+
body.append('tenantId', request.tenantId.toString());
|
|
4210
|
+
}
|
|
4211
|
+
if (request.user_code !== null && request.user_code !== undefined) {
|
|
4212
|
+
body.append('user_code', request.user_code);
|
|
4213
|
+
}
|
|
4214
|
+
return this.startAnonymous()
|
|
4215
|
+
.withUri('/oauth2/device/user-code')
|
|
4216
|
+
.withFormData(body)
|
|
4217
|
+
.withMethod("POST")
|
|
4218
|
+
.go();
|
|
4219
|
+
}
|
|
3770
4220
|
/**
|
|
3771
4221
|
* Retrieves all the comments for the user with the given Id.
|
|
3772
4222
|
*
|
|
@@ -5208,6 +5658,22 @@ class FusionAuthClient {
|
|
|
5208
5658
|
.withMethod("GET")
|
|
5209
5659
|
.go();
|
|
5210
5660
|
}
|
|
5661
|
+
/**
|
|
5662
|
+
* Validates the end-user provided user_code from the user-interaction of the Device Authorization Grant.
|
|
5663
|
+
* If you build your own activation form you should validate the user provided code prior to beginning the Authorization grant.
|
|
5664
|
+
*
|
|
5665
|
+
* @param {ValidateDeviceRequest} request The device validation request.
|
|
5666
|
+
* @returns {Promise<ClientResponse<void>>}
|
|
5667
|
+
*/
|
|
5668
|
+
validateDeviceWithRequest(request) {
|
|
5669
|
+
return this.startAnonymous()
|
|
5670
|
+
.withUri('/oauth2/device/validate')
|
|
5671
|
+
.withParameter('client_id', request.client_id)
|
|
5672
|
+
.withParameter('tenantId', request.tenantId != null ? request.tenantId.toString() : null)
|
|
5673
|
+
.withParameter('user_code', request.user_code)
|
|
5674
|
+
.withMethod("GET")
|
|
5675
|
+
.go();
|
|
5676
|
+
}
|
|
5211
5677
|
/**
|
|
5212
5678
|
* Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly
|
|
5213
5679
|
* signed and not expired.
|
|
@@ -5702,6 +6168,14 @@ var EventType;
|
|
|
5702
6168
|
EventType["UserIdentityVerified"] = "user.identity.verified";
|
|
5703
6169
|
EventType["UserIdentityUpdate"] = "user.identity.update";
|
|
5704
6170
|
})(EventType = exports.EventType || (exports.EventType = {}));
|
|
6171
|
+
/**
|
|
6172
|
+
* Represent the various states/expectations of a user in the context of starting verification
|
|
6173
|
+
*/
|
|
6174
|
+
var ExistingUserStrategy;
|
|
6175
|
+
(function (ExistingUserStrategy) {
|
|
6176
|
+
ExistingUserStrategy["mustExist"] = "mustExist";
|
|
6177
|
+
ExistingUserStrategy["mustNotExist"] = "mustNotExist";
|
|
6178
|
+
})(ExistingUserStrategy = exports.ExistingUserStrategy || (exports.ExistingUserStrategy = {}));
|
|
5705
6179
|
/**
|
|
5706
6180
|
* @author Brian Pontarelli
|
|
5707
6181
|
*/
|
|
@@ -5754,6 +6228,15 @@ var FormFieldAdminPolicy;
|
|
|
5754
6228
|
FormFieldAdminPolicy["Edit"] = "Edit";
|
|
5755
6229
|
FormFieldAdminPolicy["View"] = "View";
|
|
5756
6230
|
})(FormFieldAdminPolicy = exports.FormFieldAdminPolicy || (exports.FormFieldAdminPolicy = {}));
|
|
6231
|
+
/**
|
|
6232
|
+
* Denotes the type of form step. This is used to configure different behavior on form steps in the registration flow.
|
|
6233
|
+
*/
|
|
6234
|
+
var FormStepType;
|
|
6235
|
+
(function (FormStepType) {
|
|
6236
|
+
FormStepType["collectData"] = "collectData";
|
|
6237
|
+
FormStepType["verifyEmail"] = "verifyEmail";
|
|
6238
|
+
FormStepType["verifyPhoneNumber"] = "verifyPhoneNumber";
|
|
6239
|
+
})(FormStepType = exports.FormStepType || (exports.FormStepType = {}));
|
|
5757
6240
|
/**
|
|
5758
6241
|
* @author Daniel DeGroff
|
|
5759
6242
|
*/
|
|
@@ -5885,12 +6368,14 @@ var KeyAlgorithm;
|
|
|
5885
6368
|
KeyAlgorithm["RS256"] = "RS256";
|
|
5886
6369
|
KeyAlgorithm["RS384"] = "RS384";
|
|
5887
6370
|
KeyAlgorithm["RS512"] = "RS512";
|
|
6371
|
+
KeyAlgorithm["Ed25519"] = "Ed25519";
|
|
5888
6372
|
})(KeyAlgorithm = exports.KeyAlgorithm || (exports.KeyAlgorithm = {}));
|
|
5889
6373
|
var KeyType;
|
|
5890
6374
|
(function (KeyType) {
|
|
5891
6375
|
KeyType["EC"] = "EC";
|
|
5892
6376
|
KeyType["RSA"] = "RSA";
|
|
5893
6377
|
KeyType["HMAC"] = "HMAC";
|
|
6378
|
+
KeyType["OKP"] = "OKP";
|
|
5894
6379
|
})(KeyType = exports.KeyType || (exports.KeyType = {}));
|
|
5895
6380
|
/**
|
|
5896
6381
|
* The use type of a key.
|
|
@@ -5950,6 +6435,7 @@ var LambdaType;
|
|
|
5950
6435
|
LambdaType["SelfServiceRegistrationValidation"] = "SelfServiceRegistrationValidation";
|
|
5951
6436
|
LambdaType["UserInfoPopulate"] = "UserInfoPopulate";
|
|
5952
6437
|
LambdaType["LoginValidation"] = "LoginValidation";
|
|
6438
|
+
LambdaType["MFARequirement"] = "MFARequirement";
|
|
5953
6439
|
})(LambdaType = exports.LambdaType || (exports.LambdaType = {}));
|
|
5954
6440
|
/**
|
|
5955
6441
|
* @author Matthew Altman
|
|
@@ -5975,6 +6461,15 @@ var MessengerType;
|
|
|
5975
6461
|
MessengerType["Kafka"] = "Kafka";
|
|
5976
6462
|
MessengerType["Twilio"] = "Twilio";
|
|
5977
6463
|
})(MessengerType = exports.MessengerType || (exports.MessengerType = {}));
|
|
6464
|
+
/**
|
|
6465
|
+
* Communicate various actions/contexts in which multi-factor authentication can be used.
|
|
6466
|
+
*/
|
|
6467
|
+
var MultiFactorAction;
|
|
6468
|
+
(function (MultiFactorAction) {
|
|
6469
|
+
MultiFactorAction["changePassword"] = "changePassword";
|
|
6470
|
+
MultiFactorAction["login"] = "login";
|
|
6471
|
+
MultiFactorAction["stepUp"] = "stepUp";
|
|
6472
|
+
})(MultiFactorAction = exports.MultiFactorAction || (exports.MultiFactorAction = {}));
|
|
5978
6473
|
/**
|
|
5979
6474
|
* @author Daniel DeGroff
|
|
5980
6475
|
*/
|