stytch 10.23.0 → 10.25.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: e2fb08700aeee0c0840e48859d8dc235da8d2aaf781645d76b257d72478d84ac
4
- data.tar.gz: b76a0da30460f7973558c2c7b6fa134af9c67df528e6b9e90e5780f444145260
3
+ metadata.gz: 2f2f709cf39fcc571c655a577f0846ef68c7767d4aeace2f2ea71f3d85781018
4
+ data.tar.gz: afc3c7c5ce1dd327d2c5ab25f1b130eb25c355207bd8a15ac9db2c986b3f7eda
5
5
  SHA512:
6
- metadata.gz: 3e05a4ca1b82b877382db1ff2e98ae9d2687c82e4a0f1d084b2ea8c7e52ea5abc5da17e450378a353e9c5f300e890da5e02f1a8c4931f5506df098b89c2affc1
7
- data.tar.gz: 6ad571d7bbf7d452d20e742dbf340836b0c5cb68ae1e6ddce55022c5ef19a431a71a4d32d6053f573f2487f1d0132b3876332681bed627f0e593009149b4745d
6
+ metadata.gz: 9e1391f4ed96c281b6303f26532211f75332ce36fa012eba7629d2d2c6982b8fae6366778cff1b54a6b847e7893dac7926080e387893acb6d4efdd0a1029fb5c
7
+ data.tar.gz: 94b8e29c50c8901bdb605e729de1440deaf73682d53e1da186862267a77bf7fc6545f63aec865fc25b61273da56d2c348b40d811e7b5690315158593bad5c49c
@@ -13,6 +13,7 @@ require_relative 'b2b_scim'
13
13
  require_relative 'b2b_sessions'
14
14
  require_relative 'b2b_sso'
15
15
  require_relative 'b2b_totps'
16
+ require_relative 'connected_apps'
16
17
  require_relative 'fraud'
17
18
  require_relative 'm2m'
18
19
  require_relative 'project'
@@ -22,7 +23,7 @@ module StytchB2B
22
23
  class Client
23
24
  ENVIRONMENTS = %i[live test].freeze
24
25
 
25
- attr_reader :discovery, :fraud, :impersonation, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
26
+ attr_reader :connected_app, :discovery, :fraud, :impersonation, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
26
27
 
27
28
  def initialize(project_id:, secret:, env: nil, fraud_env: nil, &block)
28
29
  @api_host = api_host(env, project_id)
@@ -36,6 +37,7 @@ module StytchB2B
36
37
  rbac = StytchB2B::RBAC.new(@connection)
37
38
  @policy_cache = StytchB2B::PolicyCache.new(rbac_client: rbac)
38
39
 
40
+ @connected_app = Stytch::ConnectedApp.new(@connection)
39
41
  @discovery = StytchB2B::Discovery.new(@connection)
40
42
  @fraud = Stytch::Fraud.new(@fraud_connection)
41
43
  @impersonation = StytchB2B::Impersonation.new(@connection)
@@ -29,7 +29,7 @@ module StytchB2B
29
29
 
30
30
  # Exchange an Intermediate Session for a fully realized [Member Session](https://stytch.com/docs/b2b/api/session-object) for the [Organization](https://stytch.com/docs/b2b/api/organization-object) that the user wishes to log into.
31
31
  #
32
- # This endpoint can be used to accept invites and into a new Organization on the basis of the user's email domain or OAuth tenant.
32
+ # This endpoint can be used to accept invites and JIT Provision into a new Organization on the basis of the user's email domain or OAuth tenant.
33
33
  #
34
34
  # If the user **has** already satisfied the authentication requirements of the Organization they are trying to exchange into and logged in with a method that verifies their email address, this API will return `member_authenticated: true` and a `session_token` and `session_jwt`.
35
35
  #
@@ -69,7 +69,7 @@ module StytchB2B
69
69
  # Total custom claims size cannot exceed four kilobytes.
70
70
  # The type of this field is nilable +object+.
71
71
  # locale::
72
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
72
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
73
73
  #
74
74
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
75
75
  #
@@ -144,7 +144,7 @@ module StytchB2B
144
144
  @connection = connection
145
145
  end
146
146
 
147
- # This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a authentication flow to create a new
147
+ # This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a Discovery authentication flow to create a new
148
148
  # [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object) and log the user in. If the user wants to log into an existing Organization, use the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) instead.
149
149
  #
150
150
  # Stytch **requires that users verify their email address** prior to creating a new Organization in order to prevent Account Takeover (ATO) attacks and phishing.
@@ -16,14 +16,14 @@ module StytchB2B
16
16
  @connection = connection
17
17
  end
18
18
 
19
- # Authenticate an impersonation token to impersonate a. This endpoint requires an impersonation token that is not expired or previously used.
19
+ # Authenticate an impersonation token to impersonate a Member. This endpoint requires an impersonation token that is not expired or previously used.
20
20
  # A Stytch session will be created for the impersonated member with a 60 minute duration. Impersonated sessions cannot be extended.
21
21
  #
22
22
  # Prior to this step, you can generate an impersonation token by visiting the Stytch Dashboard, viewing a member, and clicking the `Impersonate Member` button.
23
23
  #
24
24
  # == Parameters:
25
25
  # impersonation_token::
26
- # The User Impersonation token to authenticate.
26
+ # The Member Impersonation token to authenticate. Expires in 5 minutes by default.
27
27
  # The type of this field is +String+.
28
28
  #
29
29
  # == Returns:
@@ -20,10 +20,10 @@ module StytchB2B
20
20
  @discovery = StytchB2B::MagicLinks::Discovery.new(@connection)
21
21
  end
22
22
 
23
- # Authenticate a with a Magic Link. This endpoint requires a Magic Link token that is not expired or previously used. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
23
+ # Authenticate a Member with a Magic Link. This endpoint requires a Magic Link token that is not expired or previously used. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
24
24
  # Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
25
25
  #
26
- # If the Member is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
26
+ # If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
27
27
  # The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp),
28
28
  # or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete the MFA step and acquire a full member session.
29
29
  # The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
@@ -67,7 +67,7 @@ module StytchB2B
67
67
  # Total custom claims size cannot exceed four kilobytes.
68
68
  # The type of this field is nilable +object+.
69
69
  # locale::
70
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
70
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
71
71
  #
72
72
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
73
73
  #
@@ -277,7 +277,7 @@ module StytchB2B
277
277
  post_request('/v1/b2b/magic_links/email/login_or_signup', request, headers)
278
278
  end
279
279
 
280
- # Send an invite email to a new to join an. The Member will be created with an `invited` status until they successfully authenticate. Sending invites to `pending` Members will update their status to `invited`. Sending invites to already `active` Members will return an error.
280
+ # Send an invite email to a new Member to join an Organization. The Member will be created with an `invited` status until they successfully authenticate. Sending invites to `pending` Members will update their status to `invited`. Sending invites to already `active` Members will return an error.
281
281
  #
282
282
  # The magic link invite will be valid for 1 week.
283
283
  #
@@ -19,9 +19,9 @@ module StytchB2B
19
19
  @discovery = StytchB2B::OAuth::Discovery.new(@connection)
20
20
  end
21
21
 
22
- # Authenticate a given a `token`. This endpoint verifies that the member completed the flow by verifying that the token is valid and hasn't expired. Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
22
+ # Authenticate a Member given a `token`. This endpoint verifies that the member completed the OAuth flow by verifying that the token is valid and hasn't expired. Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
23
23
  #
24
- # If the Member is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
24
+ # If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
25
25
  # The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.
26
26
  # The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
27
27
  # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
@@ -65,7 +65,7 @@ module StytchB2B
65
65
  # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
66
66
  # The type of this field is nilable +String+.
67
67
  # locale::
68
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
68
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
69
69
  #
70
70
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
71
71
  #
@@ -165,7 +165,7 @@ module StytchB2B
165
165
  @connection = connection
166
166
  end
167
167
 
168
- # Authenticates the Discovery token and exchanges it for an Intermediate
168
+ # Authenticates the Discovery OAuth token and exchanges it for an Intermediate
169
169
  # Session Token. Intermediate Session Tokens can be used for various Discovery login flows and are valid for 10 minutes.
170
170
  #
171
171
  # == Parameters:
@@ -95,7 +95,7 @@ module StytchB2B
95
95
  @members = StytchB2B::Organizations::Members.new(@connection)
96
96
  end
97
97
 
98
- # Creates an. An `organization_name` and a unique `organization_slug` are required.
98
+ # Creates an Organization. An `organization_name` and a unique `organization_slug` are required.
99
99
  #
100
100
  # By default, `email_invites` and `sso_jit_provisioning` will be set to `ALL_ALLOWED`, and `mfa_policy` will be set to `OPTIONAL` if no Organization authentication settings are explicitly defined in the request.
101
101
  #
@@ -291,7 +291,7 @@ module StytchB2B
291
291
  post_request('/v1/b2b/organizations', request, headers)
292
292
  end
293
293
 
294
- # Returns an specified by `organization_id`.
294
+ # Returns an Organization specified by `organization_id`.
295
295
  #
296
296
  # == Parameters:
297
297
  # organization_id::
@@ -318,7 +318,7 @@ module StytchB2B
318
318
  get_request(request, headers)
319
319
  end
320
320
 
321
- # Updates an specified by `organization_id`. An Organization must always have at least one auth setting set to either `RESTRICTED` or `ALL_ALLOWED` in order to provision new Members.
321
+ # Updates an Organization specified by `organization_id`. An Organization must always have at least one auth setting set to either `RESTRICTED` or `ALL_ALLOWED` in order to provision new Members.
322
322
  #
323
323
  # *See the [Organization authentication settings](https://stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like `email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.
324
324
  #
@@ -567,7 +567,7 @@ module StytchB2B
567
567
  put_request("/v1/b2b/organizations/#{organization_id}", request, headers)
568
568
  end
569
569
 
570
- # Deletes an specified by `organization_id`. All Members of the Organization will also be deleted.
570
+ # Deletes an Organization specified by `organization_id`. All Members of the Organization will also be deleted.
571
571
  #
572
572
  # == Parameters:
573
573
  # organization_id::
@@ -886,6 +886,25 @@ module StytchB2B
886
886
  end
887
887
  end
888
888
 
889
+ class StartEmailUpdateRequestOptions
890
+ # Optional authorization object.
891
+ # Pass in an active Stytch Member session token or session JWT and the request
892
+ # will be run using that member's permissions.
893
+ attr_accessor :authorization
894
+
895
+ def initialize(
896
+ authorization: nil
897
+ )
898
+ @authorization = authorization
899
+ end
900
+
901
+ def to_headers
902
+ headers = {}
903
+ headers.merge!(@authorization.to_headers) if authorization
904
+ headers
905
+ end
906
+ end
907
+
889
908
  class GetConnectedAppsRequestOptions
890
909
  # Optional authorization object.
891
910
  # Pass in an active Stytch Member session token or session JWT and the request
@@ -934,7 +953,7 @@ module StytchB2B
934
953
  @connected_apps = StytchB2B::Organizations::Members::ConnectedApps.new(@connection)
935
954
  end
936
955
 
937
- # Updates a specified by `organization_id` and `member_id`.
956
+ # Updates a Member specified by `organization_id` and `member_id`.
938
957
  #
939
958
  # == Parameters:
940
959
  # organization_id::
@@ -1067,7 +1086,7 @@ module StytchB2B
1067
1086
  put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request, headers)
1068
1087
  end
1069
1088
 
1070
- # Deletes a specified by `organization_id` and `member_id`.
1089
+ # Deletes a Member specified by `organization_id` and `member_id`.
1071
1090
  #
1072
1091
  # == Parameters:
1073
1092
  # organization_id::
@@ -1101,7 +1120,7 @@ module StytchB2B
1101
1120
  delete_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", headers)
1102
1121
  end
1103
1122
 
1104
- # Reactivates a deleted's status and its associated email status (if applicable) to active, specified by `organization_id` and `member_id`. This endpoint will only work for Members with at least one verified email where their `email_address_verified` is `true`.
1123
+ # Reactivates a deleted Member's status and its associated email status (if applicable) to active, specified by `organization_id` and `member_id`. This endpoint will only work for Members with at least one verified email where their `email_address_verified` is `true`.
1105
1124
  #
1106
1125
  # == Parameters:
1107
1126
  # organization_id::
@@ -1143,7 +1162,7 @@ module StytchB2B
1143
1162
  put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/reactivate", request, headers)
1144
1163
  end
1145
1164
 
1146
- # Delete a's MFA phone number.
1165
+ # Delete a Member's MFA phone number.
1147
1166
  #
1148
1167
  # To change a Member's phone number, you must first call this endpoint to delete the existing phone number.
1149
1168
  #
@@ -1290,7 +1309,9 @@ module StytchB2B
1290
1309
  post_request('/v1/b2b/organizations/members/search', request, headers)
1291
1310
  end
1292
1311
 
1293
- # Delete a's password.
1312
+ # Delete a Member's password.
1313
+ #
1314
+ # This endpoint only works for Organization-scoped passwords. For cross-org password Projects, use [Require Password Reset By Email](https://stytch.com/docs/b2b/api/passwords-require-reset-by-email) instead.
1294
1315
  #
1295
1316
  # == Parameters:
1296
1317
  # organization_id::
@@ -1408,7 +1429,7 @@ module StytchB2B
1408
1429
  get_request(request, headers)
1409
1430
  end
1410
1431
 
1411
- # Unlinks a retired email address from a specified by their `organization_id` and `member_id`. The email address
1432
+ # Unlinks a retired email address from a Member specified by their `organization_id` and `member_id`. The email address
1412
1433
  # to be retired can be identified in the request body by either its `email_id`, its `email_address`, or both. If using
1413
1434
  # both identifiers they must refer to the same email.
1414
1435
  #
@@ -1421,7 +1442,6 @@ module StytchB2B
1421
1442
  # A retired email address cannot be used by other Members in the same Organization. However, unlinking retired email
1422
1443
  # addresses allows them to be subsequently re-used by other Organization Members. Retired email addresses can be viewed
1423
1444
  # on the [Member object](https://stytch.com/docs/b2b/api/member-object).
1424
- # %}
1425
1445
  #
1426
1446
  # == Parameters:
1427
1447
  # organization_id::
@@ -1476,6 +1496,86 @@ module StytchB2B
1476
1496
  post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/unlink_retired_email", request, headers)
1477
1497
  end
1478
1498
 
1499
+ # Starts a self-serve email update for a Member specified by their `organization_id` and `member_id`.
1500
+ # To perform a self-serve update, members must be active and have an active, verified email address.
1501
+ #
1502
+ # The new email address must meet the following requirements:
1503
+ #
1504
+ # - Must not be in use by another member (retired emails count as used until they are [unlinked](https://stytch.com/docs/b2b/api/unlink-retired-member-email))
1505
+ # - Must not be updating for another member (i.e. two members cannot attempt to update to the same email at once)
1506
+ #
1507
+ # The member will receive an Email Magic Link that expires in 5 minutes. If they do not verify their new email address in that timeframe, the email
1508
+ # will be freed up for other members to use.
1509
+ #
1510
+ # == Parameters:
1511
+ # organization_id::
1512
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug here as a convenience.
1513
+ # The type of this field is +String+.
1514
+ # member_id::
1515
+ # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member.
1516
+ # The type of this field is +String+.
1517
+ # email_address::
1518
+ # The email address of the Member.
1519
+ # The type of this field is +String+.
1520
+ # login_redirect_url::
1521
+ # The URL that the Member clicks from the login Email Magic Link. This URL should be an endpoint in the backend server that
1522
+ # verifies the request by querying Stytch's authenticate endpoint and finishes the login. If this value is not passed, the default login
1523
+ # redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
1524
+ # The type of this field is nilable +String+.
1525
+ # locale::
1526
+ # Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
1527
+ #
1528
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), French (`"fr"`) and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
1529
+ #
1530
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
1531
+ #
1532
+ # The type of this field is nilable +StartEmailUpdateRequestLocale+ (string enum).
1533
+ # login_template_id::
1534
+ # Use a custom template for login emails. By default, it will use your default email template. The template must be from Stytch's
1535
+ # built-in customizations or a custom HTML email for Magic Links - Login.
1536
+ # The type of this field is nilable +String+.
1537
+ #
1538
+ # == Returns:
1539
+ # An object with the following fields:
1540
+ # request_id::
1541
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
1542
+ # The type of this field is +String+.
1543
+ # member_id::
1544
+ # Globally unique UUID that identifies a specific Member.
1545
+ # The type of this field is +String+.
1546
+ # member::
1547
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object)
1548
+ # The type of this field is +Member+ (+object+).
1549
+ # organization::
1550
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
1551
+ # The type of this field is +Organization+ (+object+).
1552
+ # status_code::
1553
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
1554
+ # The type of this field is +Integer+.
1555
+ #
1556
+ # == Method Options:
1557
+ # This method supports an optional +StytchB2B::Organizations::Members::StartEmailUpdateRequestOptions+ object which will modify the headers sent in the HTTP request.
1558
+ def start_email_update(
1559
+ organization_id:,
1560
+ member_id:,
1561
+ email_address:,
1562
+ login_redirect_url: nil,
1563
+ locale: nil,
1564
+ login_template_id: nil,
1565
+ method_options: nil
1566
+ )
1567
+ headers = {}
1568
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
1569
+ request = {
1570
+ email_address: email_address
1571
+ }
1572
+ request[:login_redirect_url] = login_redirect_url unless login_redirect_url.nil?
1573
+ request[:locale] = locale unless locale.nil?
1574
+ request[:login_template_id] = login_template_id unless login_template_id.nil?
1575
+
1576
+ post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/start_email_update", request, headers)
1577
+ end
1578
+
1479
1579
  # Member Get Connected Apps retrieves a list of Connected Apps with which the Member has successfully completed an
1480
1580
  # authorization flow.
1481
1581
  # If the Member revokes a Connected App's access (e.g. via the Revoke Connected App endpoint) then the Connected App will
@@ -1516,7 +1616,7 @@ module StytchB2B
1516
1616
  get_request(request, headers)
1517
1617
  end
1518
1618
 
1519
- # Creates a. An `organization_id` and `email_address` are required.
1619
+ # Creates a Member. An `organization_id` and `email_address` are required.
1520
1620
  #
1521
1621
  # == Parameters:
1522
1622
  # organization_id::
@@ -27,7 +27,7 @@ module StytchB2B
27
27
  @connection = connection
28
28
  end
29
29
 
30
- # Send a One-Time Passcode (OTP) to a's phone number.
30
+ # Send a One-Time Passcode (OTP) to a Member's phone number.
31
31
  #
32
32
  # If the Member already has a phone number, the `mfa_phone_number` field is not needed; the endpoint will send an OTP to the number associated with the Member.
33
33
  # If the Member does not have a phone number, the endpoint will send an OTP to the `mfa_phone_number` provided and link the `mfa_phone_number` with the Member.
@@ -45,7 +45,7 @@ module StytchB2B
45
45
  #
46
46
  # Even when international SMS is enabled, we do not support sending SMS to countries on our [Unsupported countries list](https://stytch.com/docs/guides/passcodes/unsupported-countries).
47
47
  #
48
- # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please reach out to [support@stytch.com](mailto:support@stytch.com?subject=Enable%20international%20SMS).
48
+ # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please add those countries to your Project's allowlist via [the API](https://stytch.com/docs/workspace-management/pwa/country-code-allowlist-object), and [add credit card details](https://stytch.com/docs/dashboard/settings/billing) to your account.
49
49
  #
50
50
  # == Parameters:
51
51
  # organization_id::
@@ -128,7 +128,7 @@ module StytchB2B
128
128
  # such as [email magic link authenticate](https://stytch.com/docs/b2b/api/authenticate-magic-link),
129
129
  # or upon successful calls to discovery authenticate methods, such as [email magic link discovery authenticate](https://stytch.com/docs/b2b/api/authenticate-discovery-magic-link).
130
130
  #
131
- # If the's MFA policy is `REQUIRED_FOR_ALL`, a successful OTP authentication will change the's `mfa_enrolled` status to `true` if it is not already `true`.
131
+ # If the Organization's MFA policy is `REQUIRED_FOR_ALL`, a successful OTP authentication will change the Member's `mfa_enrolled` status to `true` if it is not already `true`.
132
132
  # If the Organization's MFA policy is `OPTIONAL`, the Member's MFA enrollment can be toggled by passing in a value for the `set_mfa_enrollment` field.
133
133
  # The Member's MFA enrollment can also be toggled through the [Update Member](https://stytch.com/docs/b2b/api/update-member) endpoint.
134
134
  #
@@ -324,11 +324,11 @@ module StytchB2B
324
324
  post_request('/v1/b2b/otps/email/login_or_signup', request, headers)
325
325
  end
326
326
 
327
- # Authenticate a with a one-time passcode (OTP). This endpoint requires an OTP that is not expired or previously used.
327
+ # Authenticate a Member with a one-time passcode (OTP). This endpoint requires an OTP that is not expired or previously used.
328
328
  # OTPs have a default expiry of 10 minutes. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
329
329
  # Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
330
330
  #
331
- # If the Member is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
331
+ # If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
332
332
  # The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp),
333
333
  # or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete the MFA step and acquire a full member session.
334
334
  # The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
@@ -231,7 +231,7 @@ module StytchB2B
231
231
  #
232
232
  # If you have breach detection during authentication enabled in your [password strength policy](https://stytch.com/docs/b2b/guides/passwords/strength-policies) and the member's credentials have appeared in the HaveIBeenPwned dataset, this endpoint will return a `member_reset_password` error even if the member enters a correct password. We force a password reset in this case to ensure that the member is the legitimate owner of the email address and not a malicious actor abusing the compromised credentials.
233
233
  #
234
- # If the is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
234
+ # If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
235
235
  # The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.
236
236
  # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
237
237
  #
@@ -272,7 +272,7 @@ module StytchB2B
272
272
  # Total custom claims size cannot exceed four kilobytes.
273
273
  # The type of this field is nilable +object+.
274
274
  # locale::
275
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
275
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
276
276
  #
277
277
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
278
278
  #
@@ -471,7 +471,7 @@ module StytchB2B
471
471
  post_request('/v1/b2b/passwords/email/reset/start', request, headers)
472
472
  end
473
473
 
474
- # Reset the's password and authenticate them. This endpoint checks that the password reset token is valid, hasn’t expired, or already been used.
474
+ # Reset the Member's password and authenticate them. This endpoint checks that the password reset token is valid, hasn’t expired, or already been used.
475
475
  #
476
476
  # The provided password needs to meet our password strength requirements, which can be checked in advance with the password strength endpoint. If the token and password are accepted, the password is securely stored for future authentication and the user is authenticated.
477
477
  #
@@ -522,7 +522,7 @@ module StytchB2B
522
522
  # Total custom claims size cannot exceed four kilobytes.
523
523
  # The type of this field is nilable +object+.
524
524
  # locale::
525
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
525
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
526
526
  #
527
527
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
528
528
  #
@@ -608,6 +608,8 @@ module StytchB2B
608
608
 
609
609
  # Require a password be reset by the associated email address. This endpoint is only functional for cross-org password use cases.
610
610
  #
611
+ # If there are is only one active Member using the associated email address in the Project, the password will be deleted.
612
+ #
611
613
  # == Parameters:
612
614
  # email_address::
613
615
  # The email address of the Member to start the email reset process for.
@@ -661,7 +663,7 @@ module StytchB2B
661
663
  @connection = connection
662
664
  end
663
665
 
664
- # Reset the's password using their existing session. The endpoint will error if the session does not contain an authentication factor that has been issued within the last 5 minutes. Either `session_token` or `session_jwt` should be provided.
666
+ # Reset the Member's password using their existing session. The endpoint will error if the session does not contain an authentication factor that has been issued within the last 5 minutes. Either `session_token` or `session_jwt` should be provided.
665
667
  #
666
668
  # Note that a successful password reset via an existing session will revoke all active sessions for the `member_id`, except for the one used during the reset flow.
667
669
  #
@@ -771,7 +773,7 @@ module StytchB2B
771
773
  @connection = connection
772
774
  end
773
775
 
774
- # Reset the’s password using their existing password.
776
+ # Reset the member’s password using their existing password.
775
777
  #
776
778
  # This endpoint adapts to your Project's password strength configuration.
777
779
  # If you're using [zxcvbn](https://stytch.com/docs/guides/passwords/strength-policy), the default, your passwords are considered valid
@@ -825,7 +827,7 @@ module StytchB2B
825
827
  # Total custom claims size cannot exceed four kilobytes.
826
828
  # The type of this field is nilable +object+.
827
829
  # locale::
828
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
830
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
829
831
  #
830
832
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
831
833
  #
@@ -16,7 +16,7 @@ module StytchB2B
16
16
  @connection = connection
17
17
  end
18
18
 
19
- # Allows a to complete an MFA flow by consuming a recovery code. This consumes the recovery code and returns a session token that can be used to authenticate the Member.
19
+ # Allows a Member to complete an MFA flow by consuming a recovery code. This consumes the recovery code and returns a session token that can be used to authenticate the Member.
20
20
  #
21
21
  # == Parameters:
22
22
  # organization_id::
@@ -110,7 +110,7 @@ module StytchB2B
110
110
  post_request('/v1/b2b/recovery_codes/recover', request, headers)
111
111
  end
112
112
 
113
- # Returns a's full set of active recovery codes.
113
+ # Returns a Member's full set of active recovery codes.
114
114
  #
115
115
  # == Parameters:
116
116
  # organization_id::
@@ -150,7 +150,7 @@ module StytchB2B
150
150
  get_request(request, headers)
151
151
  end
152
152
 
153
- # Rotate a's recovery codes. This invalidates all existing recovery codes and generates a new set of recovery codes.
153
+ # Rotate a Member's recovery codes. This invalidates all existing recovery codes and generates a new set of recovery codes.
154
154
  #
155
155
  # == Parameters:
156
156
  # organization_id::
@@ -91,7 +91,7 @@ module StytchB2B
91
91
  #
92
92
  # You may provide a JWT that needs to be refreshed and is expired according to its `exp` claim. A new JWT will be returned if both the signature and the underlying Session are still valid. See our [How to use Stytch Session JWTs](https://stytch.com/docs/b2b/guides/sessions/resources/using-jwts) guide for more information.
93
93
  #
94
- # If an `authorization_check` object is passed in, this method will also check if the Member is authorized to perform the given action on the given Resource in the specified. A is authorized if their Member Session contains a Role, assigned [explicitly or implicitly](https://stytch.com/docs/b2b/guides/rbac/role-assignment), with adequate permissions.
94
+ # If an `authorization_check` object is passed in, this method will also check if the Member is authorized to perform the given action on the given Resource in the specified Organization. A Member is authorized if their Member Session contains a Role, assigned [explicitly or implicitly](https://stytch.com/docs/b2b/guides/rbac/role-assignment), with adequate permissions.
95
95
  # In addition, the `organization_id` passed in the authorization check must match the Member's Organization.
96
96
  #
97
97
  # If the Member is not authorized to perform the specified action on the specified Resource, or if the
@@ -229,9 +229,9 @@ module StytchB2B
229
229
  post_request('/v1/b2b/sessions/revoke', request, headers)
230
230
  end
231
231
 
232
- # Use this endpoint to exchange a's existing session for another session in a different. This can be used to accept an invite, but not to create a new member via domain matching.
232
+ # Use this endpoint to exchange a Member's existing session for another session in a different Organization. This can be used to accept an invite, but not to create a new member via domain matching.
233
233
  #
234
- # To create a new member via email domain, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
234
+ # To create a new member via email domain JIT Provisioning, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
235
235
  #
236
236
  # If the user **has** already satisfied the authentication requirements of the Organization they are trying to switch into, this API will return `member_authenticated: true` and a `session_token` and `session_jwt`.
237
237
  #
@@ -275,7 +275,7 @@ module StytchB2B
275
275
  # Total custom claims size cannot exceed four kilobytes.
276
276
  # The type of this field is nilable +object+.
277
277
  # locale::
278
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
278
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
279
279
  #
280
280
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
281
281
  #
@@ -505,7 +505,7 @@ module StytchB2B
505
505
 
506
506
  # Migrate a session from an external OIDC compliant endpoint.
507
507
  # Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/docs/dashboard), and then perform a lookup using the `session_token`. <!-- FIXME more specific dashboard link-->
508
- # If the response contains a valid email address, Stytch will attempt to match that email address with an existing in your and create a Stytch Session.
508
+ # If the response contains a valid email address, Stytch will attempt to match that email address with an existing Member in your Organization and create a Stytch Session.
509
509
  # You will need to create the member before using this endpoint.
510
510
  #
511
511
  # == Parameters:
@@ -137,7 +137,7 @@ module StytchB2B
137
137
  # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
138
138
  # To link this authentication event to an existing Stytch session, include either the `session_token` or `session_jwt` param.
139
139
  #
140
- # If the is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
140
+ # If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
141
141
  # The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp),
142
142
  # or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete the MFA step and acquire a full member session.
143
143
  # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
@@ -176,7 +176,7 @@ module StytchB2B
176
176
  # Total custom claims size cannot exceed four kilobytes.
177
177
  # The type of this field is nilable +object+.
178
178
  # locale::
179
- # If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
179
+ # If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
180
180
  #
181
181
  # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
182
182
  #
@@ -16,7 +16,7 @@ module StytchB2B
16
16
  @connection = connection
17
17
  end
18
18
 
19
- # Create a new TOTP instance for a. The Member can use the authenticator application of their choice to scan the QR code or enter the secret.
19
+ # Create a new TOTP instance for a Member. The Member can use the authenticator application of their choice to scan the QR code or enter the secret.
20
20
  #
21
21
  # Passing an intermediate session token, session token, or session JWT is not required, but if passed must match the Member ID passed.
22
22
  #
@@ -196,7 +196,7 @@ module StytchB2B
196
196
  post_request('/v1/b2b/totp/authenticate', request, headers)
197
197
  end
198
198
 
199
- # Migrate an existing TOTP instance for a. Recovery codes are not required and will be minted for the Member if not provided.
199
+ # Migrate an existing TOTP instance for a Member. Recovery codes are not required and will be minted for the Member if not provided.
200
200
  #
201
201
  # == Parameters:
202
202
  # organization_id::
data/lib/stytch/client.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'connected_apps'
3
4
  require_relative 'crypto_wallets'
4
5
  require_relative 'fraud'
5
6
  require_relative 'impersonation'
@@ -18,7 +19,7 @@ module Stytch
18
19
  class Client
19
20
  ENVIRONMENTS = %i[live test].freeze
20
21
 
21
- attr_reader :crypto_wallets, :fraud, :impersonation, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn
22
+ attr_reader :connected_app, :crypto_wallets, :fraud, :impersonation, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn
22
23
 
23
24
  def initialize(project_id:, secret:, env: nil, fraud_env: nil, &block)
24
25
  @api_host = api_host(env, project_id)
@@ -29,6 +30,7 @@ module Stytch
29
30
 
30
31
  create_connection(&block)
31
32
 
33
+ @connected_app = Stytch::ConnectedApp.new(@connection)
32
34
  @crypto_wallets = Stytch::CryptoWallets.new(@connection)
33
35
  @fraud = Stytch::Fraud.new(@fraud_connection)
34
36
  @impersonation = Stytch::Impersonation.new(@connection)
@@ -0,0 +1,372 @@
1
+ # frozen_string_literal: true
2
+
3
+ # !!!
4
+ # WARNING: This file is autogenerated
5
+ # Only modify code within MANUAL() sections
6
+ # or your changes may be overwritten later!
7
+ # !!!
8
+
9
+ require_relative 'request_helper'
10
+
11
+ module Stytch
12
+ class ConnectedApp
13
+ include Stytch::RequestHelper
14
+ attr_reader :clients
15
+
16
+ def initialize(connection)
17
+ @connection = connection
18
+
19
+ @clients = Stytch::ConnectedApp::Clients.new(@connection)
20
+ end
21
+
22
+ class Clients
23
+ include Stytch::RequestHelper
24
+ attr_reader :secrets
25
+
26
+ def initialize(connection)
27
+ @connection = connection
28
+
29
+ @secrets = Stytch::ConnectedApp::Clients::Secrets.new(@connection)
30
+ end
31
+
32
+ # Retrieve details of a specific Connected App by `client_id`.
33
+ #
34
+ # == Parameters:
35
+ # client_id::
36
+ # The ID of the Connected App client.
37
+ # The type of this field is +String+.
38
+ #
39
+ # == Returns:
40
+ # An object with the following fields:
41
+ # request_id::
42
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
43
+ # The type of this field is +String+.
44
+ # connected_app::
45
+ # The Connected App affected by this operation.
46
+ # The type of this field is +ConnectedApp+ (+object+).
47
+ # status_code::
48
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
49
+ # The type of this field is +Integer+.
50
+ def get(
51
+ client_id:
52
+ )
53
+ headers = {}
54
+ query_params = {}
55
+ request = request_with_query_params("/v1/connected_apps/clients/#{client_id}", query_params)
56
+ get_request(request, headers)
57
+ end
58
+
59
+ # Updates mutable fields of a Connected App. Cannot update Client Type, Client ID, or Secrets.
60
+ #
61
+ # == Parameters:
62
+ # client_id::
63
+ # The ID of the client.
64
+ # The type of this field is +String+.
65
+ # client_name::
66
+ # A human-readable name for the client.
67
+ # The type of this field is nilable +String+.
68
+ # client_description::
69
+ # A human-readable description for the client.
70
+ # The type of this field is nilable +String+.
71
+ # redirect_urls::
72
+ # Array of redirect URI values for use in OAuth Authorization flows.
73
+ # The type of this field is nilable list of +String+.
74
+ # full_access_allowed::
75
+ # Valid for first party clients only. If `true`, an authorization token granted to this Client can be exchanged for a full Stytch session.
76
+ # The type of this field is nilable +Boolean+.
77
+ # access_token_expiry_minutes::
78
+ # The number of minutes before the access token expires. The default is 60 minutes.
79
+ # The type of this field is nilable +Integer+.
80
+ # access_token_custom_audience::
81
+ # The custom audience for the access token.
82
+ # The type of this field is nilable +String+.
83
+ # access_token_template_content::
84
+ # The content of the access token custom claims template. The template must be a valid JSON object.
85
+ # The type of this field is nilable +String+.
86
+ # post_logout_redirect_urls::
87
+ # Array of redirect URI values for use in OIDC Logout flows.
88
+ # The type of this field is nilable list of +String+.
89
+ # logo_url::
90
+ # The logo URL of the Connected App, if any.
91
+ # The type of this field is nilable +String+.
92
+ # bypass_consent_for_offline_access::
93
+ # Valid for first party clients only. If true, the client does not need to request explicit user consent for the `offline_access` scope.
94
+ # The type of this field is nilable +Boolean+.
95
+ #
96
+ # == Returns:
97
+ # An object with the following fields:
98
+ # request_id::
99
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
100
+ # The type of this field is +String+.
101
+ # connected_app::
102
+ # The Connected App affected by this operation.
103
+ # The type of this field is +ConnectedApp+ (+object+).
104
+ # status_code::
105
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
106
+ # The type of this field is +Integer+.
107
+ def update(
108
+ client_id:,
109
+ client_name: nil,
110
+ client_description: nil,
111
+ redirect_urls: nil,
112
+ full_access_allowed: nil,
113
+ access_token_expiry_minutes: nil,
114
+ access_token_custom_audience: nil,
115
+ access_token_template_content: nil,
116
+ post_logout_redirect_urls: nil,
117
+ logo_url: nil,
118
+ bypass_consent_for_offline_access: nil
119
+ )
120
+ headers = {}
121
+ request = {}
122
+ request[:client_name] = client_name unless client_name.nil?
123
+ request[:client_description] = client_description unless client_description.nil?
124
+ request[:redirect_urls] = redirect_urls unless redirect_urls.nil?
125
+ request[:full_access_allowed] = full_access_allowed unless full_access_allowed.nil?
126
+ request[:access_token_expiry_minutes] = access_token_expiry_minutes unless access_token_expiry_minutes.nil?
127
+ request[:access_token_custom_audience] = access_token_custom_audience unless access_token_custom_audience.nil?
128
+ request[:access_token_template_content] = access_token_template_content unless access_token_template_content.nil?
129
+ request[:post_logout_redirect_urls] = post_logout_redirect_urls unless post_logout_redirect_urls.nil?
130
+ request[:logo_url] = logo_url unless logo_url.nil?
131
+ request[:bypass_consent_for_offline_access] = bypass_consent_for_offline_access unless bypass_consent_for_offline_access.nil?
132
+
133
+ put_request("/v1/connected_apps/clients/#{client_id}", request, headers)
134
+ end
135
+
136
+ # Deletes a Connected App.
137
+ #
138
+ # == Parameters:
139
+ # client_id::
140
+ # The ID of the client.
141
+ # The type of this field is +String+.
142
+ #
143
+ # == Returns:
144
+ # An object with the following fields:
145
+ # request_id::
146
+ # (no documentation yet)
147
+ # The type of this field is +String+.
148
+ # client_id::
149
+ # The ID of the client.
150
+ # The type of this field is +String+.
151
+ # status_code::
152
+ # (no documentation yet)
153
+ # The type of this field is +Integer+.
154
+ def delete(
155
+ client_id:
156
+ )
157
+ headers = {}
158
+ delete_request("/v1/connected_apps/clients/#{client_id}", headers)
159
+ end
160
+
161
+ # Search for Connected Apps. Supports cursor-based pagination. Specific filters coming soon.
162
+ #
163
+ # == Parameters:
164
+ # cursor::
165
+ # The `cursor` field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the `cursor`. If you receive a response that includes a non-null `next_cursor` in the `results_metadata` object, repeat the search call with the `next_cursor` value set to the `cursor` field to retrieve the next page of results. Continue to make search calls until the `next_cursor` in the response is null.
166
+ # The type of this field is nilable +String+.
167
+ # limit::
168
+ # The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the `cursor` field.
169
+ # The type of this field is nilable +Integer+.
170
+ #
171
+ # == Returns:
172
+ # An object with the following fields:
173
+ # request_id::
174
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
175
+ # The type of this field is +String+.
176
+ # connected_apps::
177
+ # (no documentation yet)
178
+ # The type of this field is list of +ConnectedApp+ (+object+).
179
+ # results_metadata::
180
+ # The search `results_metadata` object contains metadata relevant to your specific query like total and `next_cursor`.
181
+ # The type of this field is +ResultsMetadata+ (+object+).
182
+ # status_code::
183
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
184
+ # The type of this field is +Integer+.
185
+ def search(
186
+ cursor: nil,
187
+ limit: nil
188
+ )
189
+ headers = {}
190
+ request = {}
191
+ request[:cursor] = cursor unless cursor.nil?
192
+ request[:limit] = limit unless limit.nil?
193
+
194
+ post_request('/v1/connected_apps/clients/search', request, headers)
195
+ end
196
+
197
+ # Creates a new Connected App. If the Connected App `client_type` is `first_party` or `third_party` a `client_secret` is returned.
198
+ #
199
+ # **Important:** This is the only time you will be able to view the generated `client_secret` in the API response. Stytch stores a hash of the `client_secret` and cannot recover the value if lost. Be sure to persist the `client_secret` in a secure location. If the `client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.
200
+ #
201
+ # == Parameters:
202
+ # client_type::
203
+ # The type of Connected App. Supported values are `first_party`, `first_party_public`, `third_party`, and `third_party_public`.
204
+ # The type of this field is +CreateRequestClientType+ (string enum).
205
+ # redirect_urls::
206
+ # Array of redirect URI values for use in OAuth Authorization flows.
207
+ # The type of this field is list of +String+.
208
+ # full_access_allowed::
209
+ # Valid for first party clients only. If `true`, an authorization token granted to this Client can be exchanged for a full Stytch session.
210
+ # The type of this field is +Boolean+.
211
+ # post_logout_redirect_urls::
212
+ # Array of redirect URI values for use in OIDC Logout flows.
213
+ # The type of this field is list of +String+.
214
+ # client_name::
215
+ # A human-readable name for the client.
216
+ # The type of this field is nilable +String+.
217
+ # client_description::
218
+ # A human-readable description for the client.
219
+ # The type of this field is nilable +String+.
220
+ # access_token_expiry_minutes::
221
+ # The number of minutes before the access token expires. The default is 60 minutes.
222
+ # The type of this field is nilable +Integer+.
223
+ # access_token_custom_audience::
224
+ # The custom audience for the access token.
225
+ # The type of this field is nilable +String+.
226
+ # access_token_template_content::
227
+ # The content of the access token custom claims template. The template must be a valid JSON object.
228
+ # The type of this field is nilable +String+.
229
+ # logo_url::
230
+ # The logo URL of the Connected App, if any.
231
+ # The type of this field is nilable +String+.
232
+ # bypass_consent_for_offline_access::
233
+ # Valid for first party clients only. If true, the client does not need to request explicit user consent for the `offline_access` scope.
234
+ # The type of this field is nilable +Boolean+.
235
+ #
236
+ # == Returns:
237
+ # An object with the following fields:
238
+ # request_id::
239
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
240
+ # The type of this field is +String+.
241
+ # connected_app::
242
+ # The Connected App created by this API call.
243
+ # The type of this field is +ConnectedAppWithClientSecret+ (+object+).
244
+ # status_code::
245
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
246
+ # The type of this field is +Integer+.
247
+ def create(
248
+ client_type:,
249
+ redirect_urls:,
250
+ full_access_allowed:,
251
+ post_logout_redirect_urls:,
252
+ client_name: nil,
253
+ client_description: nil,
254
+ access_token_expiry_minutes: nil,
255
+ access_token_custom_audience: nil,
256
+ access_token_template_content: nil,
257
+ logo_url: nil,
258
+ bypass_consent_for_offline_access: nil
259
+ )
260
+ headers = {}
261
+ request = {
262
+ client_type: client_type,
263
+ redirect_urls: redirect_urls,
264
+ full_access_allowed: full_access_allowed,
265
+ post_logout_redirect_urls: post_logout_redirect_urls
266
+ }
267
+ request[:client_name] = client_name unless client_name.nil?
268
+ request[:client_description] = client_description unless client_description.nil?
269
+ request[:access_token_expiry_minutes] = access_token_expiry_minutes unless access_token_expiry_minutes.nil?
270
+ request[:access_token_custom_audience] = access_token_custom_audience unless access_token_custom_audience.nil?
271
+ request[:access_token_template_content] = access_token_template_content unless access_token_template_content.nil?
272
+ request[:logo_url] = logo_url unless logo_url.nil?
273
+ request[:bypass_consent_for_offline_access] = bypass_consent_for_offline_access unless bypass_consent_for_offline_access.nil?
274
+
275
+ post_request('/v1/connected_apps/clients', request, headers)
276
+ end
277
+
278
+ class Secrets
279
+ include Stytch::RequestHelper
280
+
281
+ def initialize(connection)
282
+ @connection = connection
283
+ end
284
+
285
+ # Initiate the rotation of a Connected App client secret. After this endpoint is called, both the client's `client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the Rotate Secret Endpoint to complete the flow.
286
+ # Secret rotation can be cancelled using the Cancel Secret Rotation endpoint.
287
+ #
288
+ # **Important:** This is the only time you will be able to view the generated `next_client_secret` in the API response. Stytch stores a hash of the `next_client_secret` and cannot recover the value if lost. Be sure to persist the `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.
289
+ #
290
+ # == Parameters:
291
+ # client_id::
292
+ # The ID of the client.
293
+ # The type of this field is +String+.
294
+ #
295
+ # == Returns:
296
+ # An object with the following fields:
297
+ # request_id::
298
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
299
+ # The type of this field is +String+.
300
+ # connected_app::
301
+ # The Connected App affected by this operation.
302
+ # The type of this field is +ConnectedAppWithNextClientSecret+ (+object+).
303
+ # status_code::
304
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
305
+ # The type of this field is +Integer+.
306
+ def rotate_start(
307
+ client_id:
308
+ )
309
+ headers = {}
310
+ request = {}
311
+
312
+ post_request("/v1/connected_apps/clients/#{client_id}/secrets/rotate/start", request, headers)
313
+ end
314
+
315
+ # Cancel the rotation of a Connected App client secret started with the Start Secret Rotation Endpoint. After this endpoint is called, the client's `next_client_secret` is discarded and only the original `client_secret` will be valid.
316
+ #
317
+ # == Parameters:
318
+ # client_id::
319
+ # The ID of the client.
320
+ # The type of this field is +String+.
321
+ #
322
+ # == Returns:
323
+ # An object with the following fields:
324
+ # request_id::
325
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
326
+ # The type of this field is +String+.
327
+ # connected_app::
328
+ # The Connected App affected by this operation.
329
+ # The type of this field is +ConnectedApp+ (+object+).
330
+ # status_code::
331
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
332
+ # The type of this field is +Integer+.
333
+ def rotate_cancel(
334
+ client_id:
335
+ )
336
+ headers = {}
337
+ request = {}
338
+
339
+ post_request("/v1/connected_apps/clients/#{client_id}/secrets/rotate/cancel", request, headers)
340
+ end
341
+
342
+ # Complete the rotation of a Connected App client secret started with the Rotate Secret Start Endpoint.
343
+ # After this endpoint is called, the client's `next_client_secret` becomes its `client_secret` and the previous `client_secret` will no longer be valid.
344
+ #
345
+ # == Parameters:
346
+ # client_id::
347
+ # The ID of the client.
348
+ # The type of this field is +String+.
349
+ #
350
+ # == Returns:
351
+ # An object with the following fields:
352
+ # request_id::
353
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
354
+ # The type of this field is +String+.
355
+ # connected_app::
356
+ # The Connected App affected by this operation.
357
+ # The type of this field is +ConnectedApp+ (+object+).
358
+ # status_code::
359
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
360
+ # The type of this field is +Integer+.
361
+ def rotate(
362
+ client_id:
363
+ )
364
+ headers = {}
365
+ request = {}
366
+
367
+ post_request("/v1/connected_apps/clients/#{client_id}/secrets/rotate", request, headers)
368
+ end
369
+ end
370
+ end
371
+ end
372
+ end
@@ -23,7 +23,7 @@ module Stytch
23
23
  #
24
24
  # == Parameters:
25
25
  # impersonation_token::
26
- # The User Impersonation token to authenticate.
26
+ # The User Impersonation token to authenticate. Expires in 5 minutes by default.
27
27
  # The type of this field is +String+.
28
28
  #
29
29
  # == Returns:
data/lib/stytch/otps.rb CHANGED
@@ -130,7 +130,7 @@ module Stytch
130
130
  # ### Cost to send SMS OTP
131
131
  # Before configuring SMS or WhatsApp OTPs, please review how Stytch [bills the costs of international OTPs](https://stytch.com/pricing) and understand how to protect your app against [toll fraud](https://stytch.com/docs/guides/passcodes/toll-fraud/overview).
132
132
  #
133
- # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please reach out to [support@stytch.com](mailto:support@stytch.com?subject=Enable%20international%20SMS).
133
+ # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please add those countries to your Project's allowlist via [the API](https://stytch.com/docs/workspace-management/pwa/country-code-allowlist-object), and [add credit card details](https://stytch.com/docs/dashboard/settings/billing) to your account.
134
134
  #
135
135
  # Even when international SMS is enabled, we do not support sending SMS to countries on our [Unsupported countries list](https://stytch.com/docs/guides/passcodes/unsupported-countries).
136
136
  #
@@ -212,7 +212,7 @@ module Stytch
212
212
  # ### Cost to send SMS OTP
213
213
  # Before configuring SMS or WhatsApp OTPs, please review how Stytch [bills the costs of international OTPs](https://stytch.com/pricing) and understand how to protect your app against [toll fraud](https://stytch.com/docs/guides/passcodes/toll-fraud/overview).
214
214
  #
215
- # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please reach out to [support@stytch.com](mailto:support@stytch.com?subject=Enable%20international%20SMS).
215
+ # __Note:__ SMS to phone numbers outside of the US and Canada is disabled by default for customers who did not use SMS prior to October 2023. If you're interested in sending international SMS, please add those countries to your Project's allowlist via [the API](https://stytch.com/docs/workspace-management/pwa/country-code-allowlist-object), and [add credit card details](https://stytch.com/docs/dashboard/settings/billing) to your account.
216
216
  #
217
217
  # Even when international SMS is enabled, we do not support sending SMS to countries on our [Unsupported countries list](https://stytch.com/docs/guides/passcodes/unsupported-countries).
218
218
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '10.23.0'
4
+ VERSION = '10.25.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.23.0
4
+ version: 10.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-07-07 00:00:00.000000000 Z
11
+ date: 2025-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -139,6 +139,7 @@ files:
139
139
  - lib/stytch/b2b_sso.rb
140
140
  - lib/stytch/b2b_totps.rb
141
141
  - lib/stytch/client.rb
142
+ - lib/stytch/connected_apps.rb
142
143
  - lib/stytch/crypto_wallets.rb
143
144
  - lib/stytch/errors.rb
144
145
  - lib/stytch/fraud.rb