fusionauth_client 1.61.0 → 1.63.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58e317fccbd8e1d274a59b80f7f1fc3718687bdf07596a65b13e023d95afd128
4
- data.tar.gz: 1d86814be6744576d95c37204e5422b7b3323eb42595fc8971004ec70d912f3d
3
+ metadata.gz: a00315e90f98c3c9f7e999642cf40a2cd7f145d01bdbc93f1873ee5f72be6277
4
+ data.tar.gz: a71f19cbd3bfe127ea09608a15ac7ba1a265145d72be831b2f6dcd5f6a36a6e0
5
5
  SHA512:
6
- metadata.gz: a314f61c7f1483f59e9f5355e83b29ab246ab8e37663dd8643540f007fc5a9d823393ac0daeec562bc9710e9733e12005ad9eb9a864439d773bbf1b3ad30d195
7
- data.tar.gz: fa0bd3953165d6b8da5829ccb6efac9299e776bf96bfc3fb0a52bdf19bba72c6a5897b12f554297013bc3d11f557f1321a7562ec258a26ce42ffa5383b0c9fe6
6
+ metadata.gz: c28c51b421c16e5a686e06f68ad92726e5ccf9affc3ab37805bc511f533a1cbcaf36f3f8fca8f32cf28a1b988e175d92f19c3cf761723b41c079fd91c7cfddb0
7
+ data.tar.gz: e94ec3411fbe056acc2074d74c48c53dccb971cc54656924e70bc4b6f83fcbfd058d614c074cf2e07db24aefaeb9cd07e75ac041298eadc087a6d5d2c483f6e8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fusionauth_client (1.61.0)
4
+ fusionauth_client (1.63.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/build.savant CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  pubVersion = ""
18
- project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.61.0", licenses: ["ApacheV2_0"]) {
18
+ project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.63.0", licenses: ["ApacheV2_0"]) {
19
19
  workflow {
20
20
  fetch {
21
21
  cache()
@@ -9,7 +9,19 @@
9
9
  <orderEntry type="jdk" jdkName="rbenv: 3.4.2" jdkType="RUBY_SDK" />
10
10
  <orderEntry type="sourceFolder" forTests="false" />
11
11
  <orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.2, rbenv: 3.4.2) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="cgi (v0.4.2, rbenv: 3.4.2) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, rbenv: 3.4.2) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="erb (v2.2.3, rbenv: 3.4.2) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="extralite-bundle (v1.27, rbenv: 3.4.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.5, rbenv: 3.4.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.6, rbenv: 3.4.2) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="psych (v5.2.3, rbenv: 3.4.2) [gem]" level="application" />
12
19
  <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.4.2) [gem]" level="application" />
13
20
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, rbenv: 3.4.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rdoc (v6.13.0, rbenv: 3.4.2) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rdoc-markdown (v0.4.2, rbenv: 3.4.2) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="reverse_markdown (v2.1.1, rbenv: 3.4.2) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.6, rbenv: 3.4.2) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="unindent (v1.0, rbenv: 3.4.2) [gem]" level="application" />
14
26
  </component>
15
- </module>
27
+ </module>
@@ -19,7 +19,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19
19
 
20
20
  Gem::Specification.new do |spec|
21
21
  spec.name = 'fusionauth_client'
22
- spec.version = '1.61.0'
22
+ spec.version = '1.63.0'
23
23
  spec.authors = ['Brian Pontarelli', 'Daniel DeGroff']
24
24
  spec.email = %w(brian@fusionauth.io daniel@fusionauth.io)
25
25
 
@@ -2,7 +2,7 @@ require 'ostruct'
2
2
  require 'fusionauth/rest_client'
3
3
 
4
4
  #
5
- # Copyright (c) 2018-2025, FusionAuth, All Rights Reserved
5
+ # Copyright (c) 2018-2026, FusionAuth, All Rights Reserved
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
@@ -90,14 +90,33 @@ module FusionAuth
90
90
  # @param user_code [string] The end-user verification code.
91
91
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
92
92
  def approve_device(client_id, client_secret, token, user_code)
93
- body = {
93
+ form_parameters = {
94
94
  "client_id" => client_id,
95
95
  "client_secret" => client_secret,
96
96
  "token" => token,
97
- "user_code" => user_code
97
+ "user_code" => user_code,
98
98
  }
99
99
  start.uri('/oauth2/device/approve')
100
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
100
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
101
+ .post
102
+ .go
103
+ end
104
+
105
+ #
106
+ # Approve a device grant.
107
+ #
108
+ # @param request [OpenStruct, Hash] The request object containing the device approval information and optional tenantId.
109
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
110
+ def approve_device_with_request(request)
111
+ form_parameters = {
112
+ "client_id" => request.client_id,
113
+ "client_secret" => request.client_secret,
114
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
115
+ "token" => request.token,
116
+ "user_code" => request.user_code,
117
+ }
118
+ start.uri('/oauth2/device/approve')
119
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
101
120
  .post
102
121
  .go
103
122
  end
@@ -199,6 +218,24 @@ module FusionAuth
199
218
  .go
200
219
  end
201
220
 
221
+ #
222
+ # Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
223
+ # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
224
+ # your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
225
+ #
226
+ # 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.
227
+ #
228
+ # @param change_password_id [string] The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
229
+ # @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
230
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
231
+ def check_change_password_using_id_and_ip_address(change_password_id, ip_address)
232
+ startAnonymous.uri('/api/user/change-password')
233
+ .url_segment(change_password_id)
234
+ .url_parameter('ipAddress', ip_address)
235
+ .get
236
+ .go
237
+ end
238
+
202
239
  #
203
240
  # Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
204
241
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -215,6 +252,24 @@ module FusionAuth
215
252
  .go
216
253
  end
217
254
 
255
+ #
256
+ # Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
257
+ # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
258
+ # your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
259
+ #
260
+ # 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.
261
+ #
262
+ # @param encoded_jwt [string] The encoded JWT (access token).
263
+ # @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
264
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
265
+ def check_change_password_using_jwt_and_ip_address(encoded_jwt, ip_address)
266
+ startAnonymous.uri('/api/user/change-password')
267
+ .authorization('Bearer ' + encoded_jwt)
268
+ .url_parameter('ipAddress', ip_address)
269
+ .get
270
+ .go
271
+ end
272
+
218
273
  #
219
274
  # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
220
275
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -231,6 +286,24 @@ module FusionAuth
231
286
  .go
232
287
  end
233
288
 
289
+ #
290
+ # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
291
+ # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
292
+ # your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
293
+ #
294
+ # 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.
295
+ #
296
+ # @param login_id [string] The loginId (email or username) of the User that you intend to change the password for.
297
+ # @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
298
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
299
+ def check_change_password_using_login_id_and_ip_address(login_id, ip_address)
300
+ start.uri('/api/user/change-password')
301
+ .url_parameter('loginId', login_id)
302
+ .url_parameter('ipAddress', ip_address)
303
+ .get
304
+ .go
305
+ end
306
+
234
307
  #
235
308
  # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
236
309
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
@@ -249,6 +322,26 @@ module FusionAuth
249
322
  .go
250
323
  end
251
324
 
325
+ #
326
+ # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
327
+ # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
328
+ # your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
329
+ #
330
+ # 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.
331
+ #
332
+ # @param login_id [string] The loginId of the User that you intend to change the password for.
333
+ # @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
334
+ # @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
335
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
336
+ def check_change_password_using_login_id_and_login_id_types_and_ip_address(login_id, login_id_types, ip_address)
337
+ start.uri('/api/user/change-password')
338
+ .url_parameter('loginId', login_id)
339
+ .url_parameter('loginIdTypes', login_id_types)
340
+ .url_parameter('ipAddress', ip_address)
341
+ .get
342
+ .go
343
+ end
344
+
252
345
  #
253
346
  # Make a Client Credentials grant request to obtain an access token.
254
347
  #
@@ -259,14 +352,33 @@ module FusionAuth
259
352
  # @param scope [string] (Optional) This parameter is used to indicate which target entity you are requesting access. To request access to an entity, use the format target-entity:&lt;target-entity-id&gt;:&lt;roles&gt;. Roles are an optional comma separated list.
260
353
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
261
354
  def client_credentials_grant(client_id, client_secret, scope)
262
- body = {
355
+ form_parameters = {
263
356
  "client_id" => client_id,
264
357
  "client_secret" => client_secret,
265
- "grant_type" => "client_credentials",
266
- "scope" => scope
358
+ "grant_type" => 'client_credentials',
359
+ "scope" => scope,
360
+ }
361
+ startAnonymous.uri('/oauth2/token')
362
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
363
+ .post
364
+ .go
365
+ end
366
+
367
+ #
368
+ # Make a Client Credentials grant request to obtain an access token.
369
+ #
370
+ # @param request [OpenStruct, Hash] The client credentials grant request containing client authentication, scope and optional tenantId.
371
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
372
+ def client_credentials_grant_with_request(request)
373
+ form_parameters = {
374
+ "client_id" => request.client_id,
375
+ "client_secret" => request.client_secret,
376
+ "grant_type" => request.grant_type,
377
+ "scope" => request.scope,
378
+ "tenantId" => request.tenantId,
267
379
  }
268
380
  startAnonymous.uri('/oauth2/token')
269
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
381
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
270
382
  .post
271
383
  .go
272
384
  end
@@ -1300,6 +1412,18 @@ module FusionAuth
1300
1412
  .go
1301
1413
  end
1302
1414
 
1415
+ #
1416
+ # Deletes all of the WebAuthn credentials for the given User Id.
1417
+ #
1418
+ # @param user_id [string] The unique Id of the User to delete WebAuthn passkeys for.
1419
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1420
+ def delete_web_authn_credentials_for_user(user_id)
1421
+ start.uri('/api/webauthn')
1422
+ .url_parameter('userId', user_id)
1423
+ .delete
1424
+ .go
1425
+ end
1426
+
1303
1427
  #
1304
1428
  # Deletes the webhook for the given Id.
1305
1429
  #
@@ -1312,6 +1436,43 @@ module FusionAuth
1312
1436
  .go
1313
1437
  end
1314
1438
 
1439
+ #
1440
+ # Start the Device Authorization flow using form-encoded parameters
1441
+ #
1442
+ # @param client_id [string] The unique client identifier. The client Id is the Id of the FusionAuth Application in which you are attempting to authenticate.
1443
+ # @param client_secret [string] (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.
1444
+ # @param scope [string] (Optional) A space-delimited string of the requested scopes. Defaults to all scopes configured in the Application's OAuth configuration.
1445
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1446
+ def device_authorize(client_id, client_secret, scope)
1447
+ form_parameters = {
1448
+ "client_id" => client_id,
1449
+ "client_secret" => client_secret,
1450
+ "scope" => scope,
1451
+ }
1452
+ startAnonymous.uri('/oauth2/device_authorize')
1453
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1454
+ .post
1455
+ .go
1456
+ end
1457
+
1458
+ #
1459
+ # Start the Device Authorization flow using a request body
1460
+ #
1461
+ # @param request [OpenStruct, Hash] The device authorization request containing client authentication, scope, and optional device metadata.
1462
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1463
+ def device_authorize_with_request(request)
1464
+ form_parameters = {
1465
+ "client_id" => request.client_id,
1466
+ "client_secret" => request.client_secret,
1467
+ "scope" => request.scope,
1468
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
1469
+ }
1470
+ startAnonymous.uri('/oauth2/device_authorize')
1471
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1472
+ .post
1473
+ .go
1474
+ end
1475
+
1315
1476
  #
1316
1477
  # Disable two-factor authentication for a user.
1317
1478
  #
@@ -1367,15 +1528,15 @@ module FusionAuth
1367
1528
  # @param redirect_uri [string] The URI to redirect to upon a successful request.
1368
1529
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1369
1530
  def exchange_o_auth_code_for_access_token(code, client_id, client_secret, redirect_uri)
1370
- body = {
1531
+ form_parameters = {
1371
1532
  "code" => code,
1372
1533
  "client_id" => client_id,
1373
1534
  "client_secret" => client_secret,
1374
- "grant_type" => "authorization_code",
1375
- "redirect_uri" => redirect_uri
1535
+ "grant_type" => 'authorization_code',
1536
+ "redirect_uri" => redirect_uri,
1376
1537
  }
1377
1538
  startAnonymous.uri('/oauth2/token')
1378
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1539
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1379
1540
  .post
1380
1541
  .go
1381
1542
  end
@@ -1392,16 +1553,59 @@ module FusionAuth
1392
1553
  # @param code_verifier [string] The random string generated previously. Will be compared with the code_challenge sent previously, which allows the OAuth provider to authenticate your app.
1393
1554
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1394
1555
  def exchange_o_auth_code_for_access_token_using_pkce(code, client_id, client_secret, redirect_uri, code_verifier)
1395
- body = {
1556
+ form_parameters = {
1396
1557
  "code" => code,
1397
1558
  "client_id" => client_id,
1398
1559
  "client_secret" => client_secret,
1399
- "grant_type" => "authorization_code",
1560
+ "grant_type" => 'authorization_code',
1400
1561
  "redirect_uri" => redirect_uri,
1401
- "code_verifier" => code_verifier
1562
+ "code_verifier" => code_verifier,
1563
+ }
1564
+ startAnonymous.uri('/oauth2/token')
1565
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1566
+ .post
1567
+ .go
1568
+ end
1569
+
1570
+ #
1571
+ # Exchanges an OAuth authorization code and code_verifier for an access token.
1572
+ # 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.
1573
+ #
1574
+ # @param request [OpenStruct, Hash] The PKCE OAuth code access token exchange request.
1575
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1576
+ def exchange_o_auth_code_for_access_token_using_pkce_with_request(request)
1577
+ form_parameters = {
1578
+ "client_id" => request.client_id,
1579
+ "client_secret" => request.client_secret,
1580
+ "code" => request.code,
1581
+ "code_verifier" => request.code_verifier,
1582
+ "grant_type" => request.grant_type,
1583
+ "redirect_uri" => request.redirect_uri,
1584
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
1585
+ }
1586
+ startAnonymous.uri('/oauth2/token')
1587
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1588
+ .post
1589
+ .go
1590
+ end
1591
+
1592
+ #
1593
+ # Exchanges an OAuth authorization code for an access token.
1594
+ # Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.
1595
+ #
1596
+ # @param request [OpenStruct, Hash] The OAuth code access token exchange request.
1597
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1598
+ def exchange_o_auth_code_for_access_token_with_request(request)
1599
+ form_parameters = {
1600
+ "client_id" => request.client_id,
1601
+ "client_secret" => request.client_secret,
1602
+ "code" => request.code,
1603
+ "grant_type" => request.grant_type,
1604
+ "redirect_uri" => request.redirect_uri,
1605
+ "tenantId" => request.tenantId,
1402
1606
  }
1403
1607
  startAnonymous.uri('/oauth2/token')
1404
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1608
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1405
1609
  .post
1406
1610
  .go
1407
1611
  end
@@ -1418,16 +1622,38 @@ module FusionAuth
1418
1622
  # @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
1419
1623
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1420
1624
  def exchange_refresh_token_for_access_token(refresh_token, client_id, client_secret, scope, user_code)
1421
- body = {
1625
+ form_parameters = {
1422
1626
  "refresh_token" => refresh_token,
1423
1627
  "client_id" => client_id,
1424
1628
  "client_secret" => client_secret,
1425
- "grant_type" => "refresh_token",
1629
+ "grant_type" => 'refresh_token',
1426
1630
  "scope" => scope,
1427
- "user_code" => user_code
1631
+ "user_code" => user_code,
1632
+ }
1633
+ startAnonymous.uri('/oauth2/token')
1634
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1635
+ .post
1636
+ .go
1637
+ end
1638
+
1639
+ #
1640
+ # Exchange a Refresh Token for an Access Token.
1641
+ # 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.
1642
+ #
1643
+ # @param request [OpenStruct, Hash] The refresh token access token exchange request.
1644
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1645
+ def exchange_refresh_token_for_access_token_with_request(request)
1646
+ form_parameters = {
1647
+ "client_id" => request.client_id,
1648
+ "client_secret" => request.client_secret,
1649
+ "grant_type" => request.grant_type,
1650
+ "refresh_token" => request.refresh_token,
1651
+ "scope" => request.scope,
1652
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
1653
+ "user_code" => request.user_code,
1428
1654
  }
1429
1655
  startAnonymous.uri('/oauth2/token')
1430
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1656
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1431
1657
  .post
1432
1658
  .go
1433
1659
  end
@@ -1457,17 +1683,40 @@ module FusionAuth
1457
1683
  # @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
1458
1684
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1459
1685
  def exchange_user_credentials_for_access_token(username, password, client_id, client_secret, scope, user_code)
1460
- body = {
1686
+ form_parameters = {
1461
1687
  "username" => username,
1462
1688
  "password" => password,
1463
1689
  "client_id" => client_id,
1464
1690
  "client_secret" => client_secret,
1465
- "grant_type" => "password",
1691
+ "grant_type" => 'password',
1466
1692
  "scope" => scope,
1467
- "user_code" => user_code
1693
+ "user_code" => user_code,
1694
+ }
1695
+ startAnonymous.uri('/oauth2/token')
1696
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1697
+ .post
1698
+ .go
1699
+ end
1700
+
1701
+ #
1702
+ # Exchange User Credentials for a Token.
1703
+ # 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.
1704
+ #
1705
+ # @param request [OpenStruct, Hash] The user credentials access token exchange request.
1706
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1707
+ def exchange_user_credentials_for_access_token_with_request(request)
1708
+ form_parameters = {
1709
+ "client_id" => request.client_id,
1710
+ "client_secret" => request.client_secret,
1711
+ "grant_type" => request.grant_type,
1712
+ "password" => request.password,
1713
+ "scope" => request.scope,
1714
+ "tenantId" => request.tenantId,
1715
+ "user_code" => request.user_code,
1716
+ "username" => request.username,
1468
1717
  }
1469
1718
  startAnonymous.uri('/oauth2/token')
1470
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1719
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1471
1720
  .post
1472
1721
  .go
1473
1722
  end
@@ -1651,12 +1900,29 @@ module FusionAuth
1651
1900
  # @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
1652
1901
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1653
1902
  def introspect_access_token(client_id, token)
1654
- body = {
1903
+ form_parameters = {
1655
1904
  "client_id" => client_id,
1656
- "token" => token
1905
+ "token" => token,
1657
1906
  }
1658
1907
  startAnonymous.uri('/oauth2/introspect')
1659
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1908
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1909
+ .post
1910
+ .go
1911
+ end
1912
+
1913
+ #
1914
+ # 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.
1915
+ #
1916
+ # @param request [OpenStruct, Hash] The access token introspection request.
1917
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1918
+ def introspect_access_token_with_request(request)
1919
+ form_parameters = {
1920
+ "client_id" => request.client_id,
1921
+ "tenantId" => request.tenantId,
1922
+ "token" => request.token,
1923
+ }
1924
+ startAnonymous.uri('/oauth2/introspect')
1925
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1660
1926
  .post
1661
1927
  .go
1662
1928
  end
@@ -1667,11 +1933,27 @@ module FusionAuth
1667
1933
  # @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
1668
1934
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1669
1935
  def introspect_client_credentials_access_token(token)
1670
- body = {
1671
- "token" => token
1936
+ form_parameters = {
1937
+ "token" => token,
1672
1938
  }
1673
1939
  startAnonymous.uri('/oauth2/introspect')
1674
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1940
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1941
+ .post
1942
+ .go
1943
+ end
1944
+
1945
+ #
1946
+ # Inspect an access token issued as the result of the Client Credentials Grant.
1947
+ #
1948
+ # @param request [OpenStruct, Hash] The client credentials access token.
1949
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1950
+ def introspect_client_credentials_access_token_with_request(request)
1951
+ form_parameters = {
1952
+ "tenantId" => request.tenantId,
1953
+ "token" => request.token,
1954
+ }
1955
+ startAnonymous.uri('/oauth2/introspect')
1956
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1675
1957
  .post
1676
1958
  .go
1677
1959
  end
@@ -1779,7 +2061,7 @@ module FusionAuth
1779
2061
  end
1780
2062
 
1781
2063
  #
1782
- # Retrieves the identity provider for the given domain. A 200 response code indicates the domain is managed
2064
+ # Retrieves any global identity providers for the given domain. A 200 response code indicates the domain is managed
1783
2065
  # by a registered identity provider. A 404 indicates the domain is not managed.
1784
2066
  #
1785
2067
  # @param domain [string] The domain or email address to lookup.
@@ -1791,6 +2073,22 @@ module FusionAuth
1791
2073
  .go
1792
2074
  end
1793
2075
 
2076
+ #
2077
+ # Retrieves the identity provider for the given domain and tenantId. A 200 response code indicates the domain is managed
2078
+ # by a registered identity provider. A 404 indicates the domain is not managed.
2079
+ #
2080
+ # @param domain [string] The domain or email address to lookup.
2081
+ # @param tenant_id [string] If provided, the API searches for an identity provider scoped to the corresponding tenant that manages the requested domain.
2082
+ # If no result is found, the API then searches for global identity providers.
2083
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
2084
+ def lookup_identity_provider_by_tenant_id(domain, tenant_id)
2085
+ start.uri('/api/identity-provider/lookup')
2086
+ .url_parameter('domain', domain)
2087
+ .url_parameter('tenantId', tenant_id)
2088
+ .get
2089
+ .go
2090
+ end
2091
+
1794
2092
  #
1795
2093
  # Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the
1796
2094
  # action.
@@ -3309,6 +3607,18 @@ module FusionAuth
3309
3607
  .go
3310
3608
  end
3311
3609
 
3610
+ #
3611
+ # Retrieves the totals report. This allows excluding applicationTotals from the report. An empty list will include the applicationTotals.
3612
+ #
3613
+ # @param excludes [Array] List of fields to exclude in the response. Currently only allows applicationTotals.
3614
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
3615
+ def retrieve_total_report_with_excludes(excludes)
3616
+ start.uri('/api/report/totals')
3617
+ .url_parameter('excludes', excludes)
3618
+ .get
3619
+ .go
3620
+ end
3621
+
3312
3622
  #
3313
3623
  # Retrieve two-factor recovery codes for a user.
3314
3624
  #
@@ -3340,6 +3650,22 @@ module FusionAuth
3340
3650
  .go
3341
3651
  end
3342
3652
 
3653
+ #
3654
+ # Retrieve a user's two-factor status.
3655
+ #
3656
+ # This can be used to see if a user will need to complete a two-factor challenge to complete a login,
3657
+ # and optionally identify the state of the two-factor trust across various applications. This operation
3658
+ # provides more payload options than retrieveTwoFactorStatus.
3659
+ #
3660
+ # @param request [OpenStruct, Hash] The request object that contains all the information used to check the status.
3661
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
3662
+ def retrieve_two_factor_status_with_request(request)
3663
+ start.uri('/api/two-factor/status')
3664
+ .body_handler(FusionAuth::JSONBodyHandler.new(request))
3665
+ .post
3666
+ .go
3667
+ end
3668
+
3343
3669
  #
3344
3670
  # Retrieves the user for the given Id.
3345
3671
  #
@@ -3484,13 +3810,13 @@ module FusionAuth
3484
3810
  # @param user_code [string] The end-user verification code.
3485
3811
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3486
3812
  def retrieve_user_code(client_id, client_secret, user_code)
3487
- body = {
3813
+ form_parameters = {
3488
3814
  "client_id" => client_id,
3489
3815
  "client_secret" => client_secret,
3490
- "user_code" => user_code
3816
+ "user_code" => user_code,
3491
3817
  }
3492
3818
  startAnonymous.uri('/oauth2/device/user-code')
3493
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
3819
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3494
3820
  .get
3495
3821
  .go
3496
3822
  end
@@ -3505,15 +3831,55 @@ module FusionAuth
3505
3831
  # @param user_code [string] The end-user verification code.
3506
3832
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3507
3833
  def retrieve_user_code_using_api_key(user_code)
3508
- body = {
3509
- "user_code" => user_code
3834
+ form_parameters = {
3835
+ "user_code" => user_code,
3510
3836
  }
3511
3837
  startAnonymous.uri('/oauth2/device/user-code')
3512
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
3838
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3513
3839
  .get
3514
3840
  .go
3515
3841
  end
3516
3842
 
3843
+ #
3844
+ # Retrieve a user_code that is part of an in-progress Device Authorization Grant.
3845
+ #
3846
+ # This API is useful if you want to build your own login workflow to complete a device grant.
3847
+ #
3848
+ # This request will require an API key.
3849
+ #
3850
+ # @param request [OpenStruct, Hash] The user code retrieval request including optional tenantId.
3851
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
3852
+ def retrieve_user_code_using_api_key_with_request(request)
3853
+ form_parameters = {
3854
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
3855
+ "user_code" => request.user_code,
3856
+ }
3857
+ startAnonymous.uri('/oauth2/device/user-code')
3858
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3859
+ .post
3860
+ .go
3861
+ end
3862
+
3863
+ #
3864
+ # Retrieve a user_code that is part of an in-progress Device Authorization Grant.
3865
+ #
3866
+ # This API is useful if you want to build your own login workflow to complete a device grant.
3867
+ #
3868
+ # @param request [OpenStruct, Hash] The user code retrieval request.
3869
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
3870
+ def retrieve_user_code_with_request(request)
3871
+ form_parameters = {
3872
+ "client_id" => request.client_id,
3873
+ "client_secret" => request.client_secret,
3874
+ "tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
3875
+ "user_code" => request.user_code,
3876
+ }
3877
+ startAnonymous.uri('/oauth2/device/user-code')
3878
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3879
+ .post
3880
+ .go
3881
+ end
3882
+
3517
3883
  #
3518
3884
  # Retrieves all the comments for the user with the given Id.
3519
3885
  #
@@ -3667,18 +4033,6 @@ module FusionAuth
3667
4033
  .go
3668
4034
  end
3669
4035
 
3670
- #
3671
- # Retrieves the user for the given Id. This method does not use an API key, instead it uses a JSON Web Token (JWT) for authentication.
3672
- #
3673
- # @param encoded_jwt [string] The encoded JWT (access token).
3674
- # @return [FusionAuth::ClientResponse] The ClientResponse object.
3675
- def retrieve_user_using_jwt(encoded_jwt)
3676
- startAnonymous.uri('/api/user')
3677
- .authorization('Bearer ' + encoded_jwt)
3678
- .get
3679
- .go
3680
- end
3681
-
3682
4036
  #
3683
4037
  # Retrieves the FusionAuth version string.
3684
4038
  #
@@ -4851,6 +5205,21 @@ module FusionAuth
4851
5205
  .go
4852
5206
  end
4853
5207
 
5208
+ #
5209
+ # Validates the end-user provided user_code from the user-interaction of the Device Authorization Grant.
5210
+ # If you build your own activation form you should validate the user provided code prior to beginning the Authorization grant.
5211
+ #
5212
+ # @param request [OpenStruct, Hash] The device validation request.
5213
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
5214
+ def validate_device_with_request(request)
5215
+ startAnonymous.uri('/oauth2/device/validate')
5216
+ .url_parameter('client_id', request.client_id)
5217
+ .url_parameter('tenantId', request.tenantId.nil? ? nil : request.tenantId.to_s)
5218
+ .url_parameter('user_code', request.user_code)
5219
+ .get
5220
+ .go
5221
+ end
5222
+
4854
5223
  #
4855
5224
  # Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly
4856
5225
  # signed and not expired.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusionauth_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.61.0
4
+ version: 1.63.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pontarelli
8
8
  - Daniel DeGroff
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-13 00:00:00.000000000 Z
11
+ date: 2026-02-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This library contains the Ruby client library that helps you connect
14
14
  your application to FusionAuth.