stytch 10.24.0 → 10.26.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 +4 -4
- data/lib/stytch/b2b_client.rb +10 -2
- data/lib/stytch/b2b_discovery.rb +8 -8
- data/lib/stytch/b2b_idp.rb +266 -0
- data/lib/stytch/b2b_impersonation.rb +2 -2
- data/lib/stytch/b2b_magic_links.rb +4 -4
- data/lib/stytch/b2b_oauth.rb +4 -4
- data/lib/stytch/b2b_organizations.rb +125 -23
- data/lib/stytch/b2b_otp.rb +8 -6
- data/lib/stytch/b2b_passwords.rb +12 -7
- data/lib/stytch/b2b_rbac.rb +2 -2
- data/lib/stytch/b2b_recovery_codes.rb +3 -3
- data/lib/stytch/b2b_sessions.rb +8 -8
- data/lib/stytch/b2b_sso.rb +2 -2
- data/lib/stytch/b2b_totps.rb +5 -3
- data/lib/stytch/client.rb +16 -2
- data/lib/stytch/fraud.rb +6 -3
- data/lib/stytch/idp.rb +251 -0
- data/lib/stytch/impersonation.rb +1 -1
- data/lib/stytch/otps.rb +2 -2
- data/lib/stytch/passwords.rb +1 -1
- data/lib/stytch/rbac.rb +49 -0
- data/lib/stytch/rbac_local.rb +66 -3
- data/lib/stytch/sessions.rb +37 -10
- data/lib/stytch/version.rb +1 -1
- data/lib/stytch.rb +1 -0
- metadata +5 -2
@@ -95,9 +95,9 @@ 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
|
+
# If no Organization authentication setting parameters are passed in, `email_invites` will default to `ALL_ALLOWED` so that the Organization has a way to add Members. Otherwise, `email_invites` will default to `NOT_ALLOWED`.
|
101
101
|
#
|
102
102
|
# *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.
|
103
103
|
#
|
@@ -117,7 +117,7 @@ module StytchB2B
|
|
117
117
|
# sso_jit_provisioning::
|
118
118
|
# The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:
|
119
119
|
#
|
120
|
-
# `ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
120
|
+
# `ALL_ALLOWED` – the default setting, new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
121
121
|
#
|
122
122
|
# `RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.
|
123
123
|
#
|
@@ -135,7 +135,7 @@ module StytchB2B
|
|
135
135
|
#
|
136
136
|
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link or OAuth.
|
137
137
|
#
|
138
|
-
# `NOT_ALLOWED` –
|
138
|
+
# `NOT_ALLOWED` – the default setting, disables JIT provisioning via Email Magic Link and OAuth.
|
139
139
|
#
|
140
140
|
# The type of this field is nilable +String+.
|
141
141
|
# email_invites::
|
@@ -193,7 +193,7 @@ module StytchB2B
|
|
193
193
|
#
|
194
194
|
# `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
|
195
195
|
#
|
196
|
-
# `NOT_ALLOWED` –
|
196
|
+
# `NOT_ALLOWED` – the default setting, disables JIT provisioning by OAuth Tenant.
|
197
197
|
#
|
198
198
|
# The type of this field is nilable +String+.
|
199
199
|
# allowed_oauth_tenants::
|
@@ -205,7 +205,7 @@ module StytchB2B
|
|
205
205
|
# first_party_connected_apps_allowed_type::
|
206
206
|
# The authentication setting that sets the Organization's policy towards first party Connected Apps. The accepted values are:
|
207
207
|
#
|
208
|
-
# `ALL_ALLOWED` – any first party Connected App in the Project is permitted for use by Members.
|
208
|
+
# `ALL_ALLOWED` – the default setting, any first party Connected App in the Project is permitted for use by Members.
|
209
209
|
#
|
210
210
|
# `RESTRICTED` – only first party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members.
|
211
211
|
#
|
@@ -218,7 +218,7 @@ module StytchB2B
|
|
218
218
|
# third_party_connected_apps_allowed_type::
|
219
219
|
# The authentication setting that sets the Organization's policy towards third party Connected Apps. The accepted values are:
|
220
220
|
#
|
221
|
-
# `ALL_ALLOWED` – any third party Connected App in the Project is permitted for use by Members.
|
221
|
+
# `ALL_ALLOWED` – the default setting, any third party Connected App in the Project is permitted for use by Members.
|
222
222
|
#
|
223
223
|
# `RESTRICTED` – only third party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members.
|
224
224
|
#
|
@@ -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
|
#
|
@@ -354,7 +354,7 @@ module StytchB2B
|
|
354
354
|
# sso_jit_provisioning::
|
355
355
|
# The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:
|
356
356
|
#
|
357
|
-
# `ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
357
|
+
# `ALL_ALLOWED` – the default setting, new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
358
358
|
#
|
359
359
|
# `RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.
|
360
360
|
#
|
@@ -382,7 +382,7 @@ module StytchB2B
|
|
382
382
|
#
|
383
383
|
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link or OAuth.
|
384
384
|
#
|
385
|
-
# `NOT_ALLOWED` –
|
385
|
+
# `NOT_ALLOWED` – the default setting, disables JIT provisioning via Email Magic Link and OAuth.
|
386
386
|
#
|
387
387
|
#
|
388
388
|
# If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.settings.email-jit-provisioning` action on the `stytch.organization` Resource.
|
@@ -456,7 +456,7 @@ module StytchB2B
|
|
456
456
|
#
|
457
457
|
# `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
|
458
458
|
#
|
459
|
-
# `NOT_ALLOWED` –
|
459
|
+
# `NOT_ALLOWED` – the default setting, disables JIT provisioning by OAuth Tenant.
|
460
460
|
#
|
461
461
|
#
|
462
462
|
# If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.settings.oauth-tenant-jit-provisioning` action on the `stytch.organization` Resource.
|
@@ -472,7 +472,7 @@ module StytchB2B
|
|
472
472
|
# first_party_connected_apps_allowed_type::
|
473
473
|
# The authentication setting that sets the Organization's policy towards first party Connected Apps. The accepted values are:
|
474
474
|
#
|
475
|
-
# `ALL_ALLOWED` – any first party Connected App in the Project is permitted for use by Members.
|
475
|
+
# `ALL_ALLOWED` – the default setting, any first party Connected App in the Project is permitted for use by Members.
|
476
476
|
#
|
477
477
|
# `RESTRICTED` – only first party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members.
|
478
478
|
#
|
@@ -485,7 +485,7 @@ module StytchB2B
|
|
485
485
|
# third_party_connected_apps_allowed_type::
|
486
486
|
# The authentication setting that sets the Organization's policy towards third party Connected Apps. The accepted values are:
|
487
487
|
#
|
488
|
-
# `ALL_ALLOWED` – any third party Connected App in the Project is permitted for use by Members.
|
488
|
+
# `ALL_ALLOWED` – the default setting, any third party Connected App in the Project is permitted for use by Members.
|
489
489
|
#
|
490
490
|
# `RESTRICTED` – only third party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members.
|
491
491
|
#
|
@@ -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,88 @@ 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
|
+
# The Magic Link will redirect to your `login_redirect_url` (or the configured default if one isn't provided), and you should invoke the [Authenticate Magic Link](https://stytch.com/docs/b2b/api/authenticate-magic-link) endpoint as normal to complete the flow.
|
1511
|
+
#
|
1512
|
+
# == Parameters:
|
1513
|
+
# organization_id::
|
1514
|
+
# 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.
|
1515
|
+
# The type of this field is +String+.
|
1516
|
+
# member_id::
|
1517
|
+
# 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.
|
1518
|
+
# The type of this field is +String+.
|
1519
|
+
# email_address::
|
1520
|
+
# The new email address for the Member.
|
1521
|
+
# The type of this field is +String+.
|
1522
|
+
# login_redirect_url::
|
1523
|
+
# The URL that the Member clicks from the login Email Magic Link. This URL should be an endpoint in the backend server that
|
1524
|
+
# verifies the request by querying Stytch's authenticate endpoint and finishes the login. If this value is not passed, the default login
|
1525
|
+
# redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
|
1526
|
+
# The type of this field is nilable +String+.
|
1527
|
+
# locale::
|
1528
|
+
# 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"`.
|
1529
|
+
#
|
1530
|
+
# 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.
|
1531
|
+
#
|
1532
|
+
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
|
1533
|
+
#
|
1534
|
+
# The type of this field is nilable +StartEmailUpdateRequestLocale+ (string enum).
|
1535
|
+
# login_template_id::
|
1536
|
+
# Use a custom template for login emails. By default, it will use your default email template. The template must be from Stytch's
|
1537
|
+
# built-in customizations or a custom HTML email for Magic Links - Login.
|
1538
|
+
# The type of this field is nilable +String+.
|
1539
|
+
#
|
1540
|
+
# == Returns:
|
1541
|
+
# An object with the following fields:
|
1542
|
+
# request_id::
|
1543
|
+
# 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.
|
1544
|
+
# The type of this field is +String+.
|
1545
|
+
# member_id::
|
1546
|
+
# Globally unique UUID that identifies a specific Member.
|
1547
|
+
# The type of this field is +String+.
|
1548
|
+
# member::
|
1549
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object)
|
1550
|
+
# The type of this field is +Member+ (+object+).
|
1551
|
+
# organization::
|
1552
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
1553
|
+
# The type of this field is +Organization+ (+object+).
|
1554
|
+
# status_code::
|
1555
|
+
# 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.
|
1556
|
+
# The type of this field is +Integer+.
|
1557
|
+
#
|
1558
|
+
# == Method Options:
|
1559
|
+
# This method supports an optional +StytchB2B::Organizations::Members::StartEmailUpdateRequestOptions+ object which will modify the headers sent in the HTTP request.
|
1560
|
+
def start_email_update(
|
1561
|
+
organization_id:,
|
1562
|
+
member_id:,
|
1563
|
+
email_address:,
|
1564
|
+
login_redirect_url: nil,
|
1565
|
+
locale: nil,
|
1566
|
+
login_template_id: nil,
|
1567
|
+
method_options: nil
|
1568
|
+
)
|
1569
|
+
headers = {}
|
1570
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
1571
|
+
request = {
|
1572
|
+
email_address: email_address
|
1573
|
+
}
|
1574
|
+
request[:login_redirect_url] = login_redirect_url unless login_redirect_url.nil?
|
1575
|
+
request[:locale] = locale unless locale.nil?
|
1576
|
+
request[:login_template_id] = login_template_id unless login_template_id.nil?
|
1577
|
+
|
1578
|
+
post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/start_email_update", request, headers)
|
1579
|
+
end
|
1580
|
+
|
1479
1581
|
# Member Get Connected Apps retrieves a list of Connected Apps with which the Member has successfully completed an
|
1480
1582
|
# authorization flow.
|
1481
1583
|
# If the Member revokes a Connected App's access (e.g. via the Revoke Connected App endpoint) then the Connected App will
|
@@ -1516,7 +1618,7 @@ module StytchB2B
|
|
1516
1618
|
get_request(request, headers)
|
1517
1619
|
end
|
1518
1620
|
|
1519
|
-
# Creates a. An `organization_id` and `email_address` are required.
|
1621
|
+
# Creates a Member. An `organization_id` and `email_address` are required.
|
1520
1622
|
#
|
1521
1623
|
# == Parameters:
|
1522
1624
|
# organization_id::
|
data/lib/stytch/b2b_otp.rb
CHANGED
@@ -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.
|
@@ -38,14 +38,16 @@ module StytchB2B
|
|
38
38
|
#
|
39
39
|
# If a Member has a phone number and is enrolled in MFA, then after a successful primary authentication event (e.g. [email magic link](https://stytch.com/docs/b2b/api/authenticate-magic-link) or [SSO](https://stytch.com/docs/b2b/api/sso-authenticate) login is complete), an SMS OTP will automatically be sent to their phone number. In that case, this endpoint should only be used for subsequent authentication events, such as prompting a Member for an OTP again after a period of inactivity.
|
40
40
|
#
|
41
|
-
#
|
41
|
+
# If the Member already has an active MFA factor, then passing an intermediate session token, session token, or session JWT with the existing MFA factor on it is required to prevent bypassing MFA.
|
42
|
+
#
|
43
|
+
# Otherwise, passing an intermediate session token, session token, or session JWT is not required, but if passed must match the `member_id` passed.
|
42
44
|
#
|
43
45
|
# ### Cost to send SMS OTP
|
44
46
|
# 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).
|
45
47
|
#
|
46
48
|
# 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
49
|
#
|
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
|
50
|
+
# __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 [Dashboard](https://stytch.com/dashboard/country-code-allowlists) or [Programmatic Workspace Actions](https://stytch.com/docs/workspace-management/pwa/set-allowed-country-codes), and [add credit card details](https://stytch.com/dashboard/settings/billing) to your account.
|
49
51
|
#
|
50
52
|
# == Parameters:
|
51
53
|
# organization_id::
|
@@ -128,7 +130,7 @@ module StytchB2B
|
|
128
130
|
# such as [email magic link authenticate](https://stytch.com/docs/b2b/api/authenticate-magic-link),
|
129
131
|
# 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
132
|
#
|
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`.
|
133
|
+
# 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
134
|
# 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
135
|
# The Member's MFA enrollment can also be toggled through the [Update Member](https://stytch.com/docs/b2b/api/update-member) endpoint.
|
134
136
|
#
|
@@ -324,11 +326,11 @@ module StytchB2B
|
|
324
326
|
post_request('/v1/b2b/otps/email/login_or_signup', request, headers)
|
325
327
|
end
|
326
328
|
|
327
|
-
# Authenticate a with a one-time passcode (OTP). This endpoint requires an OTP that is not expired or previously used.
|
329
|
+
# Authenticate a Member with a one-time passcode (OTP). This endpoint requires an OTP that is not expired or previously used.
|
328
330
|
# OTPs have a default expiry of 10 minutes. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
|
329
331
|
# 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
332
|
#
|
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.
|
333
|
+
# 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
334
|
# 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
335
|
# 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
336
|
# 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.
|
data/lib/stytch/b2b_passwords.rb
CHANGED
@@ -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.
|
@@ -621,6 +623,9 @@ module StytchB2B
|
|
621
623
|
#
|
622
624
|
# == Returns:
|
623
625
|
# An object with the following fields:
|
626
|
+
# request_id::
|
627
|
+
# 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.
|
628
|
+
# The type of this field is +String+.
|
624
629
|
# status_code::
|
625
630
|
# 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.
|
626
631
|
# The type of this field is +Integer+.
|
@@ -661,7 +666,7 @@ module StytchB2B
|
|
661
666
|
@connection = connection
|
662
667
|
end
|
663
668
|
|
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.
|
669
|
+
# 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
670
|
#
|
666
671
|
# 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
672
|
#
|
@@ -771,7 +776,7 @@ module StytchB2B
|
|
771
776
|
@connection = connection
|
772
777
|
end
|
773
778
|
|
774
|
-
# Reset the’s password using their existing password.
|
779
|
+
# Reset the member’s password using their existing password.
|
775
780
|
#
|
776
781
|
# This endpoint adapts to your Project's password strength configuration.
|
777
782
|
# If you're using [zxcvbn](https://stytch.com/docs/guides/passwords/strength-policy), the default, your passwords are considered valid
|
@@ -825,7 +830,7 @@ module StytchB2B
|
|
825
830
|
# Total custom claims size cannot exceed four kilobytes.
|
826
831
|
# The type of this field is nilable +object+.
|
827
832
|
# 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.
|
833
|
+
# 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
834
|
#
|
830
835
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
831
836
|
#
|
data/lib/stytch/b2b_rbac.rb
CHANGED
@@ -20,7 +20,7 @@ module StytchB2B
|
|
20
20
|
#
|
21
21
|
# When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was last updated more than 5 minutes ago.
|
22
22
|
#
|
23
|
-
# Resources and Roles can be created and managed within the [RBAC page](https://stytch.com/
|
23
|
+
# Resources and Roles can be created and managed within the [RBAC page](https://stytch.com/dashboard/rbac) in the Dashboard.
|
24
24
|
# Additionally, [Role assignment](https://stytch.com/docs/b2b/guides/rbac/role-assignment) can be programmatically managed through certain Stytch API endpoints.
|
25
25
|
#
|
26
26
|
# Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC permissioning model.
|
@@ -36,7 +36,7 @@ module StytchB2B
|
|
36
36
|
# 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.
|
37
37
|
# The type of this field is +Integer+.
|
38
38
|
# policy::
|
39
|
-
# The RBAC Policy document that contains all defined Roles and Resources – which are managed in the [Dashboard](https://stytch.com/
|
39
|
+
# The RBAC Policy document that contains all defined Roles and Resources – which are managed in the [Dashboard](https://stytch.com/dashboard/rbac). Read more about these entities and how they work in our [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview).
|
40
40
|
# The type of this field is nilable +Policy+ (+object+).
|
41
41
|
def policy
|
42
42
|
headers = {}
|
@@ -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::
|
data/lib/stytch/b2b_sessions.rb
CHANGED
@@ -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
|
@@ -164,7 +164,7 @@ module StytchB2B
|
|
164
164
|
# The type of this field is +Integer+.
|
165
165
|
# verdict::
|
166
166
|
# If an `authorization_check` is provided in the request and the check succeeds, this field will return
|
167
|
-
#
|
167
|
+
# information about why the Member was granted permission.
|
168
168
|
# The type of this field is nilable +AuthorizationVerdict+ (+object+).
|
169
169
|
def authenticate(
|
170
170
|
session_token: nil,
|
@@ -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
|
#
|
@@ -417,7 +417,7 @@ module StytchB2B
|
|
417
417
|
post_request('/v1/b2b/sessions/exchange_access_token', request, headers)
|
418
418
|
end
|
419
419
|
|
420
|
-
# Exchange an auth token issued by a trusted identity provider for a Stytch session. You must first register a Trusted Auth Token profile in the Stytch dashboard [here](https://stytch.com/
|
420
|
+
# Exchange an auth token issued by a trusted identity provider for a Stytch session. You must first register a Trusted Auth Token profile in the Stytch dashboard [here](https://stytch.com/dashboard/trusted-auth-tokens). If a session token or session JWT is provided, it will add the trusted auth token as an authentication factor to the existing session.
|
421
421
|
#
|
422
422
|
# == Parameters:
|
423
423
|
# organization_id::
|
@@ -504,8 +504,8 @@ module StytchB2B
|
|
504
504
|
end
|
505
505
|
|
506
506
|
# Migrate a session from an external OIDC compliant endpoint.
|
507
|
-
# Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/
|
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.
|
507
|
+
# Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/dashboard/migrations), and then perform a lookup using the `session_token`.
|
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:
|
data/lib/stytch/b2b_sso.rb
CHANGED
@@ -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
|
#
|
data/lib/stytch/b2b_totps.rb
CHANGED
@@ -16,9 +16,11 @@ 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
|
+
# If the Member already has an active MFA factor, then passing an intermediate session token, session token, or session JWT with the existing MFA factor on it is required to prevent bypassing MFA.
|
22
|
+
#
|
23
|
+
# Otherwise, passing an intermediate session token, session token, or session JWT is not required, but if passed must match the `member_id` passed.
|
22
24
|
#
|
23
25
|
# == Parameters:
|
24
26
|
# organization_id::
|
@@ -196,7 +198,7 @@ module StytchB2B
|
|
196
198
|
post_request('/v1/b2b/totp/authenticate', request, headers)
|
197
199
|
end
|
198
200
|
|
199
|
-
# Migrate an existing TOTP instance for a. Recovery codes are not required and will be minted for the Member if not provided.
|
201
|
+
# Migrate an existing TOTP instance for a Member. Recovery codes are not required and will be minted for the Member if not provided.
|
200
202
|
#
|
201
203
|
# == Parameters:
|
202
204
|
# organization_id::
|