stytch 9.8.0 → 9.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stytch/b2b_discovery.rb +12 -12
- data/lib/stytch/b2b_oauth.rb +7 -3
- data/lib/stytch/b2b_organizations.rb +147 -2
- data/lib/stytch/b2b_otp.rb +308 -3
- data/lib/stytch/b2b_passwords.rb +250 -4
- data/lib/stytch/b2b_sso.rb +15 -9
- data/lib/stytch/m2m.rb +2 -1
- data/lib/stytch/otps.rb +2 -2
- data/lib/stytch/users.rb +9 -1
- data/lib/stytch/version.rb +1 -1
- data/lib/stytch/webauthn.rb +16 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c4852f9d2c309dd74ecef7bf04bc20d626cdfebf41d1edc4d1ca22b8c21ac5
|
4
|
+
data.tar.gz: 78598669744ab68e3d7b6f1353f6f7c3ce4ba9c0f51cfc133fdacf88bcb2cc27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c902ed37382e199a60891fe5084fe05b16e0d8930cd0b37368c16d02616bb705706775aafec4a41dfd0d20b6730caa66f8c54fd323c5889461c86ee9697b620
|
7
|
+
data.tar.gz: dbf5815d64e1eb9ab95d0463f193537f9e306a813d5fae72f21792a37a5594a8305337dc7084663604750dce50b4203fb62da47e55a2aa850f5851e733bcb9d6
|
data/lib/stytch/b2b_discovery.rb
CHANGED
@@ -163,12 +163,6 @@ module StytchB2B
|
|
163
163
|
# intermediate_session_token::
|
164
164
|
# The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
|
165
165
|
# The type of this field is +String+.
|
166
|
-
# organization_name::
|
167
|
-
# The name of the Organization. If the name is not specified, a default name will be created based on the email used to initiate the discovery flow. If the email domain is a common email provider such as gmail.com, or if the email is a .edu email, the organization name will be generated based on the name portion of the email. Otherwise, the organization name will be generated based on the email domain.
|
168
|
-
# The type of this field is +String+.
|
169
|
-
# organization_slug::
|
170
|
-
# The unique URL slug of the Organization. A minimum of two characters is required. The slug only accepts alphanumeric characters and the following reserved characters: `-` `.` `_` `~`. If the slug is not specified, a default slug will be created based on the email used to initiate the discovery flow. If the email domain is a common email provider such as gmail.com, or if the email is a .edu email, the organization slug will be generated based on the name portion of the email. Otherwise, the organization slug will be generated based on the email domain.
|
171
|
-
# The type of this field is +String+.
|
172
166
|
# session_duration_minutes::
|
173
167
|
# Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
|
174
168
|
# returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
|
@@ -187,6 +181,12 @@ module StytchB2B
|
|
187
181
|
# delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
|
188
182
|
# Total custom claims size cannot exceed four kilobytes.
|
189
183
|
# The type of this field is nilable +object+.
|
184
|
+
# organization_name::
|
185
|
+
# The name of the Organization. If the name is not specified, a default name will be created based on the email used to initiate the discovery flow. If the email domain is a common email provider such as gmail.com, or if the email is a .edu email, the organization name will be generated based on the name portion of the email. Otherwise, the organization name will be generated based on the email domain.
|
186
|
+
# The type of this field is nilable +String+.
|
187
|
+
# organization_slug::
|
188
|
+
# The unique URL slug of the Organization. A minimum of two characters is required. The slug only accepts alphanumeric characters and the following reserved characters: `-` `.` `_` `~`. If the slug is not specified, a default slug will be created based on the email used to initiate the discovery flow. If the email domain is a common email provider such as gmail.com, or if the email is a .edu email, the organization slug will be generated based on the name portion of the email. Otherwise, the organization slug will be generated based on the email domain.
|
189
|
+
# The type of this field is nilable +String+.
|
190
190
|
# organization_logo_url::
|
191
191
|
# The image URL of the Organization logo.
|
192
192
|
# The type of this field is nilable +String+.
|
@@ -276,7 +276,7 @@ module StytchB2B
|
|
276
276
|
#
|
277
277
|
# The type of this field is nilable +String+.
|
278
278
|
# allowed_oauth_tenants::
|
279
|
-
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack" and "
|
279
|
+
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github".
|
280
280
|
# The type of this field is nilable +object+.
|
281
281
|
#
|
282
282
|
# == Returns:
|
@@ -319,10 +319,10 @@ module StytchB2B
|
|
319
319
|
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
320
320
|
def create(
|
321
321
|
intermediate_session_token:,
|
322
|
-
organization_name:,
|
323
|
-
organization_slug:,
|
324
322
|
session_duration_minutes: nil,
|
325
323
|
session_custom_claims: nil,
|
324
|
+
organization_name: nil,
|
325
|
+
organization_slug: nil,
|
326
326
|
organization_logo_url: nil,
|
327
327
|
trusted_metadata: nil,
|
328
328
|
sso_jit_provisioning: nil,
|
@@ -340,12 +340,12 @@ module StytchB2B
|
|
340
340
|
)
|
341
341
|
headers = {}
|
342
342
|
request = {
|
343
|
-
intermediate_session_token: intermediate_session_token
|
344
|
-
organization_name: organization_name,
|
345
|
-
organization_slug: organization_slug
|
343
|
+
intermediate_session_token: intermediate_session_token
|
346
344
|
}
|
347
345
|
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
348
346
|
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
347
|
+
request[:organization_name] = organization_name unless organization_name.nil?
|
348
|
+
request[:organization_slug] = organization_slug unless organization_slug.nil?
|
349
349
|
request[:organization_logo_url] = organization_logo_url unless organization_logo_url.nil?
|
350
350
|
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
|
351
351
|
request[:sso_jit_provisioning] = sso_jit_provisioning unless sso_jit_provisioning.nil?
|
data/lib/stytch/b2b_oauth.rb
CHANGED
@@ -165,7 +165,8 @@ 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 token and exchanges it for an Intermediate
|
169
|
+
# Session Token. Intermediate Session Tokens can be used for various Discovery login flows and are valid for 10 minutes.
|
169
170
|
#
|
170
171
|
# == Parameters:
|
171
172
|
# discovery_oauth_token::
|
@@ -213,11 +214,14 @@ module StytchB2B
|
|
213
214
|
# c) The Organization has at least one other Member with a verified email address with the same domain as the end user (to prevent phishing attacks).
|
214
215
|
# The type of this field is list of +DiscoveredOrganization+ (+object+).
|
215
216
|
# provider_type::
|
216
|
-
#
|
217
|
+
# Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
|
217
218
|
# The type of this field is +String+.
|
218
219
|
# provider_tenant_id::
|
219
|
-
#
|
220
|
+
# The tenant ID returned by the OAuth provider. This is typically used to identify an organization or group within the provider's domain. For example, in HubSpot this is a Hub ID, in Slack this is the Workspace ID, and in GitHub this is an organization ID. This field will only be populated if exactly one tenant ID is returned from a successful OAuth authentication and developers should prefer `provider_tenant_ids` over this since it accounts for the possibility of an OAuth provider yielding multiple tenant IDs.
|
220
221
|
# The type of this field is +String+.
|
222
|
+
# provider_tenant_ids::
|
223
|
+
# All tenant IDs returned by the OAuth provider. These is typically used to identify organizations or groups within the provider's domain. For example, in HubSpot this is a Hub ID, in Slack this is the Workspace ID, and in GitHub this is an organization ID. Some OAuth providers do not return tenant IDs, some providers are guaranteed to return one, and some may return multiple. This field will always be populated if at least one tenant ID was returned from the OAuth provider and developers should prefer this field over `provider_tenant_id`.
|
224
|
+
# The type of this field is list of +String+.
|
221
225
|
# status_code::
|
222
226
|
# 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.
|
223
227
|
# The type of this field is +Integer+.
|
@@ -159,7 +159,7 @@ module StytchB2B
|
|
159
159
|
#
|
160
160
|
# The type of this field is nilable +String+.
|
161
161
|
# allowed_oauth_tenants::
|
162
|
-
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack" and "
|
162
|
+
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github".
|
163
163
|
# The type of this field is nilable +object+.
|
164
164
|
#
|
165
165
|
# == Returns:
|
@@ -385,7 +385,7 @@ module StytchB2B
|
|
385
385
|
# 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.
|
386
386
|
# The type of this field is nilable +String+.
|
387
387
|
# allowed_oauth_tenants::
|
388
|
-
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack" and "
|
388
|
+
# A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github".
|
389
389
|
#
|
390
390
|
# 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.allowed-oauth-tenants` action on the `stytch.organization` Resource.
|
391
391
|
# The type of this field is nilable +object+.
|
@@ -1137,6 +1137,32 @@ module StytchB2B
|
|
1137
1137
|
get_request(request, headers)
|
1138
1138
|
end
|
1139
1139
|
|
1140
|
+
# Retrieve the saved OIDC access tokens and ID tokens for a member. After a successful OIDC login, Stytch will save the
|
1141
|
+
# issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh the
|
1142
|
+
# access token automatically.
|
1143
|
+
#
|
1144
|
+
# == Parameters:
|
1145
|
+
# organization_id::
|
1146
|
+
# 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.
|
1147
|
+
# The type of this field is +String+.
|
1148
|
+
# member_id::
|
1149
|
+
# 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.
|
1150
|
+
# The type of this field is +String+.
|
1151
|
+
# include_refresh_token::
|
1152
|
+
# Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. **Important:** If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future.
|
1153
|
+
# The type of this field is nilable +Boolean+.
|
1154
|
+
#
|
1155
|
+
# == Returns:
|
1156
|
+
# An object with the following fields:
|
1157
|
+
# request_id::
|
1158
|
+
# 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.
|
1159
|
+
# The type of this field is +String+.
|
1160
|
+
# registrations::
|
1161
|
+
# A list of tokens the member is registered with.
|
1162
|
+
# The type of this field is list of +OIDCProviderInfo+ (+object+).
|
1163
|
+
# status_code::
|
1164
|
+
# 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.
|
1165
|
+
# The type of this field is +Integer+.
|
1140
1166
|
def oidc_providers(
|
1141
1167
|
organization_id:,
|
1142
1168
|
member_id:,
|
@@ -1475,6 +1501,125 @@ module StytchB2B
|
|
1475
1501
|
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/microsoft", query_params)
|
1476
1502
|
get_request(request, headers)
|
1477
1503
|
end
|
1504
|
+
|
1505
|
+
# Retrieve the saved Slack access token and ID token for a member. After a successful OAuth login, Stytch will save the
|
1506
|
+
# issued access token and ID token from the identity provider.
|
1507
|
+
#
|
1508
|
+
# == Parameters:
|
1509
|
+
# organization_id::
|
1510
|
+
# 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.
|
1511
|
+
# The type of this field is +String+.
|
1512
|
+
# member_id::
|
1513
|
+
# 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.
|
1514
|
+
# The type of this field is +String+.
|
1515
|
+
#
|
1516
|
+
# == Returns:
|
1517
|
+
# An object with the following fields:
|
1518
|
+
# request_id::
|
1519
|
+
# 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.
|
1520
|
+
# The type of this field is +String+.
|
1521
|
+
# provider_type::
|
1522
|
+
# Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
|
1523
|
+
# The type of this field is +String+.
|
1524
|
+
# registrations::
|
1525
|
+
# A list of tokens the member is registered with.
|
1526
|
+
# The type of this field is list of +SlackProviderInfo+ (+object+).
|
1527
|
+
# status_code::
|
1528
|
+
# 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.
|
1529
|
+
# The type of this field is +Integer+.
|
1530
|
+
def slack(
|
1531
|
+
organization_id:,
|
1532
|
+
member_id:
|
1533
|
+
)
|
1534
|
+
headers = {}
|
1535
|
+
query_params = {}
|
1536
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/slack", query_params)
|
1537
|
+
get_request(request, headers)
|
1538
|
+
end
|
1539
|
+
|
1540
|
+
# Retrieve the saved Hubspot access token and ID token for a member. After a successful OAuth login, Stytch will save the
|
1541
|
+
# issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh the
|
1542
|
+
# access token automatically.
|
1543
|
+
#
|
1544
|
+
# == Parameters:
|
1545
|
+
# organization_id::
|
1546
|
+
# 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.
|
1547
|
+
# The type of this field is +String+.
|
1548
|
+
# member_id::
|
1549
|
+
# 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.
|
1550
|
+
# The type of this field is +String+.
|
1551
|
+
# include_refresh_token::
|
1552
|
+
# Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. **Important:** If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future.
|
1553
|
+
# The type of this field is nilable +Boolean+.
|
1554
|
+
#
|
1555
|
+
# == Returns:
|
1556
|
+
# An object with the following fields:
|
1557
|
+
# request_id::
|
1558
|
+
# 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.
|
1559
|
+
# The type of this field is +String+.
|
1560
|
+
# provider_type::
|
1561
|
+
# Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
|
1562
|
+
# The type of this field is +String+.
|
1563
|
+
# registrations::
|
1564
|
+
# A list of tokens the member is registered with.
|
1565
|
+
# The type of this field is list of +HubspotProviderInfo+ (+object+).
|
1566
|
+
# status_code::
|
1567
|
+
# 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.
|
1568
|
+
# The type of this field is +Integer+.
|
1569
|
+
def hubspot(
|
1570
|
+
organization_id:,
|
1571
|
+
member_id:,
|
1572
|
+
include_refresh_token: nil
|
1573
|
+
)
|
1574
|
+
headers = {}
|
1575
|
+
query_params = {
|
1576
|
+
include_refresh_token: include_refresh_token
|
1577
|
+
}
|
1578
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/hubspot", query_params)
|
1579
|
+
get_request(request, headers)
|
1580
|
+
end
|
1581
|
+
|
1582
|
+
# Retrieve the saved GitHub access token for a Member. After a successful OAuth login, Stytch will save the
|
1583
|
+
# issued access token from the identity provider. GitHub does not issue refresh tokens, but will invalidate access
|
1584
|
+
# tokens after very long periods of inactivity.
|
1585
|
+
#
|
1586
|
+
# == Parameters:
|
1587
|
+
# organization_id::
|
1588
|
+
# 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.
|
1589
|
+
# The type of this field is +String+.
|
1590
|
+
# member_id::
|
1591
|
+
# 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.
|
1592
|
+
# The type of this field is +String+.
|
1593
|
+
# include_refresh_token::
|
1594
|
+
# Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. **Important:** If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future.
|
1595
|
+
# The type of this field is nilable +Boolean+.
|
1596
|
+
#
|
1597
|
+
# == Returns:
|
1598
|
+
# An object with the following fields:
|
1599
|
+
# request_id::
|
1600
|
+
# 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.
|
1601
|
+
# The type of this field is +String+.
|
1602
|
+
# provider_type::
|
1603
|
+
# Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
|
1604
|
+
# The type of this field is +String+.
|
1605
|
+
# registrations::
|
1606
|
+
# A list of tokens the member is registered with.
|
1607
|
+
# The type of this field is list of +GithubProviderInfo+ (+object+).
|
1608
|
+
# status_code::
|
1609
|
+
# 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.
|
1610
|
+
# The type of this field is +Integer+.
|
1611
|
+
def github(
|
1612
|
+
organization_id:,
|
1613
|
+
member_id:,
|
1614
|
+
include_refresh_token: nil
|
1615
|
+
)
|
1616
|
+
headers = {}
|
1617
|
+
query_params = {
|
1618
|
+
include_refresh_token: include_refresh_token
|
1619
|
+
}
|
1620
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/github", query_params)
|
1621
|
+
get_request(request, headers)
|
1622
|
+
end
|
1478
1623
|
end
|
1479
1624
|
end
|
1480
1625
|
end
|
data/lib/stytch/b2b_otp.rb
CHANGED
@@ -11,12 +11,13 @@ require_relative 'request_helper'
|
|
11
11
|
module StytchB2B
|
12
12
|
class OTPs
|
13
13
|
include Stytch::RequestHelper
|
14
|
-
attr_reader :sms
|
14
|
+
attr_reader :sms, :email
|
15
15
|
|
16
16
|
def initialize(connection)
|
17
17
|
@connection = connection
|
18
18
|
|
19
19
|
@sms = StytchB2B::OTPs::Sms.new(@connection)
|
20
|
+
@email = StytchB2B::OTPs::Email.new(@connection)
|
20
21
|
end
|
21
22
|
|
22
23
|
class Sms
|
@@ -33,7 +34,7 @@ module StytchB2B
|
|
33
34
|
#
|
34
35
|
# An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` does not match the existing one.
|
35
36
|
#
|
36
|
-
# Note that sending another OTP code before the first has expired will invalidate the first code.
|
37
|
+
# OTP codes expire after two minutes. Note that sending another OTP code before the first has expired will invalidate the first code.
|
37
38
|
#
|
38
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.
|
39
40
|
#
|
@@ -116,7 +117,9 @@ module StytchB2B
|
|
116
117
|
|
117
118
|
# SMS OTPs may not be used as a primary authentication mechanism. They can be used to complete an MFA requirement, or they can be used as a step-up factor to be added to an existing session.
|
118
119
|
#
|
119
|
-
# This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used.
|
120
|
+
# This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. OTP codes expire after two minutes.
|
121
|
+
#
|
122
|
+
# A given Member may only have a single active OTP code at any given time. If a Member requests another OTP code before the first one has expired, the first one will be invalidated.
|
120
123
|
#
|
121
124
|
# Exactly one of `intermediate_session_token`, `session_token`, or `session_jwt` must be provided in the request.
|
122
125
|
# If an intermediate session token is provided, this operation will consume it.
|
@@ -235,5 +238,307 @@ module StytchB2B
|
|
235
238
|
post_request('/v1/b2b/otps/sms/authenticate', request, headers)
|
236
239
|
end
|
237
240
|
end
|
241
|
+
|
242
|
+
class Email
|
243
|
+
include Stytch::RequestHelper
|
244
|
+
attr_reader :discovery
|
245
|
+
|
246
|
+
def initialize(connection)
|
247
|
+
@connection = connection
|
248
|
+
|
249
|
+
@discovery = StytchB2B::OTPs::Email::Discovery.new(@connection)
|
250
|
+
end
|
251
|
+
|
252
|
+
# Send either a login or signup email OTP to a Member. A new, pending, or invited Member will receive a signup email OTP. Non-active members will have a pending status until they successfully authenticate. An active Member will receive a login email OTP.
|
253
|
+
#
|
254
|
+
# The OTP is valid for 10 minutes. Only the most recently sent OTP is valid: when an OTP is sent, all OTPs previously sent to the same email address are invalidated, even if unused or unexpired.
|
255
|
+
#
|
256
|
+
# == Parameters:
|
257
|
+
# organization_id::
|
258
|
+
# 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.
|
259
|
+
# The type of this field is +String+.
|
260
|
+
# email_address::
|
261
|
+
# The email address of the Member.
|
262
|
+
# The type of this field is +String+.
|
263
|
+
# login_template_id::
|
264
|
+
# Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for OTP - Login.
|
265
|
+
# The type of this field is nilable +String+.
|
266
|
+
# signup_template_id::
|
267
|
+
# Use a custom template for signup emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for OTP - Signup.
|
268
|
+
# The type of this field is nilable +String+.
|
269
|
+
# locale::
|
270
|
+
# 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"`.
|
271
|
+
#
|
272
|
+
# Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
|
273
|
+
#
|
274
|
+
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
|
275
|
+
#
|
276
|
+
# The type of this field is nilable +LoginOrSignupRequestLocale+ (string enum).
|
277
|
+
#
|
278
|
+
# == Returns:
|
279
|
+
# An object with the following fields:
|
280
|
+
# request_id::
|
281
|
+
# 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.
|
282
|
+
# The type of this field is +String+.
|
283
|
+
# member_id::
|
284
|
+
# Globally unique UUID that identifies a specific Member.
|
285
|
+
# The type of this field is +String+.
|
286
|
+
# member_created::
|
287
|
+
# A flag indicating `true` if a new Member object was created and `false` if the Member object already existed.
|
288
|
+
# The type of this field is +Boolean+.
|
289
|
+
# member::
|
290
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object)
|
291
|
+
# The type of this field is +Member+ (+object+).
|
292
|
+
# organization::
|
293
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
294
|
+
# The type of this field is +Organization+ (+object+).
|
295
|
+
# status_code::
|
296
|
+
# 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.
|
297
|
+
# The type of this field is +Integer+.
|
298
|
+
def login_or_signup(
|
299
|
+
organization_id:,
|
300
|
+
email_address:,
|
301
|
+
login_template_id: nil,
|
302
|
+
signup_template_id: nil,
|
303
|
+
locale: nil
|
304
|
+
)
|
305
|
+
headers = {}
|
306
|
+
request = {
|
307
|
+
organization_id: organization_id,
|
308
|
+
email_address: email_address
|
309
|
+
}
|
310
|
+
request[:login_template_id] = login_template_id unless login_template_id.nil?
|
311
|
+
request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
|
312
|
+
request[:locale] = locale unless locale.nil?
|
313
|
+
|
314
|
+
post_request('/v1/b2b/otps/email/login_or_signup', request, headers)
|
315
|
+
end
|
316
|
+
|
317
|
+
# Authenticate a with a one-time passcode (OTP). This endpoint requires an OTP that is not expired or previously used.
|
318
|
+
# OTPs have a default expiry of 10 minutes. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
|
319
|
+
# 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.
|
320
|
+
#
|
321
|
+
# 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.
|
322
|
+
# 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),
|
323
|
+
# 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.
|
324
|
+
# 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.
|
325
|
+
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
326
|
+
#
|
327
|
+
# If a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step.
|
328
|
+
#
|
329
|
+
# == Parameters:
|
330
|
+
# organization_id::
|
331
|
+
# 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.
|
332
|
+
# The type of this field is +String+.
|
333
|
+
# email_address::
|
334
|
+
# The email address of the Member.
|
335
|
+
# The type of this field is +String+.
|
336
|
+
# code::
|
337
|
+
# The code to authenticate.
|
338
|
+
# The type of this field is +String+.
|
339
|
+
# session_token::
|
340
|
+
# A secret token for a given Stytch Session.
|
341
|
+
# The type of this field is nilable +String+.
|
342
|
+
# session_jwt::
|
343
|
+
# The JSON Web Token (JWT) for a given Stytch Session.
|
344
|
+
# The type of this field is nilable +String+.
|
345
|
+
# intermediate_session_token::
|
346
|
+
# The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
|
347
|
+
# The type of this field is nilable +String+.
|
348
|
+
# session_duration_minutes::
|
349
|
+
# Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
|
350
|
+
# returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
|
351
|
+
# five minutes regardless of the underlying session duration, and will need to be refreshed over time.
|
352
|
+
#
|
353
|
+
# This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
|
354
|
+
#
|
355
|
+
# If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
|
356
|
+
#
|
357
|
+
# If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
|
358
|
+
# to use the Stytch session product, you can ignore the session fields in the response.
|
359
|
+
# The type of this field is nilable +Integer+.
|
360
|
+
# session_custom_claims::
|
361
|
+
# Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
|
362
|
+
# `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
|
363
|
+
# delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
|
364
|
+
# Total custom claims size cannot exceed four kilobytes.
|
365
|
+
# The type of this field is nilable +object+.
|
366
|
+
# locale::
|
367
|
+
# 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"`.
|
368
|
+
#
|
369
|
+
# Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
|
370
|
+
#
|
371
|
+
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
|
372
|
+
#
|
373
|
+
# The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
|
374
|
+
#
|
375
|
+
# == Returns:
|
376
|
+
# An object with the following fields:
|
377
|
+
# request_id::
|
378
|
+
# 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.
|
379
|
+
# The type of this field is +String+.
|
380
|
+
# member_id::
|
381
|
+
# Globally unique UUID that identifies a specific Member.
|
382
|
+
# The type of this field is +String+.
|
383
|
+
# method_id::
|
384
|
+
# The email or device involved in the authentication.
|
385
|
+
# The type of this field is +String+.
|
386
|
+
# organization_id::
|
387
|
+
# 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.
|
388
|
+
# The type of this field is +String+.
|
389
|
+
# member::
|
390
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object)
|
391
|
+
# The type of this field is +Member+ (+object+).
|
392
|
+
# session_token::
|
393
|
+
# A secret token for a given Stytch Session.
|
394
|
+
# The type of this field is +String+.
|
395
|
+
# session_jwt::
|
396
|
+
# The JSON Web Token (JWT) for a given Stytch Session.
|
397
|
+
# The type of this field is +String+.
|
398
|
+
# member_session::
|
399
|
+
# The [Session object](https://stytch.com/docs/b2b/api/session-object).
|
400
|
+
# The type of this field is +MemberSession+ (+object+).
|
401
|
+
# organization::
|
402
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
403
|
+
# The type of this field is +Organization+ (+object+).
|
404
|
+
# intermediate_session_token::
|
405
|
+
# The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
|
406
|
+
# The type of this field is +String+.
|
407
|
+
# member_authenticated::
|
408
|
+
# Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
|
409
|
+
# The type of this field is +Boolean+.
|
410
|
+
# status_code::
|
411
|
+
# 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.
|
412
|
+
# The type of this field is +Integer+.
|
413
|
+
# mfa_required::
|
414
|
+
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
415
|
+
# The type of this field is nilable +MfaRequired+ (+object+).
|
416
|
+
def authenticate(
|
417
|
+
organization_id:,
|
418
|
+
email_address:,
|
419
|
+
code:,
|
420
|
+
session_token: nil,
|
421
|
+
session_jwt: nil,
|
422
|
+
intermediate_session_token: nil,
|
423
|
+
session_duration_minutes: nil,
|
424
|
+
session_custom_claims: nil,
|
425
|
+
locale: nil
|
426
|
+
)
|
427
|
+
headers = {}
|
428
|
+
request = {
|
429
|
+
organization_id: organization_id,
|
430
|
+
email_address: email_address,
|
431
|
+
code: code
|
432
|
+
}
|
433
|
+
request[:session_token] = session_token unless session_token.nil?
|
434
|
+
request[:session_jwt] = session_jwt unless session_jwt.nil?
|
435
|
+
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?
|
436
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
437
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
438
|
+
request[:locale] = locale unless locale.nil?
|
439
|
+
|
440
|
+
post_request('/v1/b2b/otps/email/authenticate', request, headers)
|
441
|
+
end
|
442
|
+
|
443
|
+
class Discovery
|
444
|
+
include Stytch::RequestHelper
|
445
|
+
|
446
|
+
def initialize(connection)
|
447
|
+
@connection = connection
|
448
|
+
end
|
449
|
+
|
450
|
+
# Send a discovery OTP to an email address. The OTP is valid for 10 minutes. Only the most recently sent OTP is valid: when an OTP is sent, all OTPs previously sent to the same email address are invalidated, even if unused or unexpired.
|
451
|
+
#
|
452
|
+
# == Parameters:
|
453
|
+
# email_address::
|
454
|
+
# The email address to start the discovery flow for.
|
455
|
+
# The type of this field is +String+.
|
456
|
+
# login_template_id::
|
457
|
+
# Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for OTP - Login.
|
458
|
+
# The type of this field is nilable +String+.
|
459
|
+
# locale::
|
460
|
+
# 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"`.
|
461
|
+
#
|
462
|
+
# Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
|
463
|
+
#
|
464
|
+
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
|
465
|
+
#
|
466
|
+
# The type of this field is nilable +SendRequestLocale+ (string enum).
|
467
|
+
#
|
468
|
+
# == Returns:
|
469
|
+
# An object with the following fields:
|
470
|
+
# request_id::
|
471
|
+
# 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.
|
472
|
+
# The type of this field is +String+.
|
473
|
+
# status_code::
|
474
|
+
# 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.
|
475
|
+
# The type of this field is +Integer+.
|
476
|
+
def send(
|
477
|
+
email_address:,
|
478
|
+
login_template_id: nil,
|
479
|
+
locale: nil
|
480
|
+
)
|
481
|
+
headers = {}
|
482
|
+
request = {
|
483
|
+
email_address: email_address
|
484
|
+
}
|
485
|
+
request[:login_template_id] = login_template_id unless login_template_id.nil?
|
486
|
+
request[:locale] = locale unless locale.nil?
|
487
|
+
|
488
|
+
post_request('/v1/b2b/otps/email/discovery/send', request, headers)
|
489
|
+
end
|
490
|
+
|
491
|
+
# Authenticates the OTP and returns an intermediate session token. Intermediate session tokens can be used for various Discovery login flows and are valid for 10 minutes.
|
492
|
+
#
|
493
|
+
# == Parameters:
|
494
|
+
# email_address::
|
495
|
+
# The email address of the Member.
|
496
|
+
# The type of this field is +String+.
|
497
|
+
# code::
|
498
|
+
# The code to authenticate.
|
499
|
+
# The type of this field is +String+.
|
500
|
+
#
|
501
|
+
# == Returns:
|
502
|
+
# An object with the following fields:
|
503
|
+
# request_id::
|
504
|
+
# 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.
|
505
|
+
# The type of this field is +String+.
|
506
|
+
# intermediate_session_token::
|
507
|
+
# The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
|
508
|
+
# The type of this field is +String+.
|
509
|
+
# email_address::
|
510
|
+
# The email address.
|
511
|
+
# The type of this field is +String+.
|
512
|
+
# discovered_organizations::
|
513
|
+
# An array of `discovered_organization` objects tied to the `intermediate_session_token`, `session_token`, or `session_jwt`. See the [Discovered Organization Object](https://stytch.com/docs/b2b/api/discovered-organization-object) for complete details.
|
514
|
+
#
|
515
|
+
# Note that Organizations will only appear here under any of the following conditions:
|
516
|
+
# 1. The end user is already a Member of the Organization.
|
517
|
+
# 2. The end user is invited to the Organization.
|
518
|
+
# 3. The end user can join the Organization because:
|
519
|
+
#
|
520
|
+
# a) The Organization allows JIT provisioning.
|
521
|
+
#
|
522
|
+
# b) The Organizations' allowed domains list contains the Member's email domain.
|
523
|
+
#
|
524
|
+
# c) The Organization has at least one other Member with a verified email address with the same domain as the end user (to prevent phishing attacks).
|
525
|
+
# The type of this field is list of +DiscoveredOrganization+ (+object+).
|
526
|
+
# status_code::
|
527
|
+
# 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.
|
528
|
+
# The type of this field is +Integer+.
|
529
|
+
def authenticate(
|
530
|
+
email_address:,
|
531
|
+
code:
|
532
|
+
)
|
533
|
+
headers = {}
|
534
|
+
request = {
|
535
|
+
email_address: email_address,
|
536
|
+
code: code
|
537
|
+
}
|
538
|
+
|
539
|
+
post_request('/v1/b2b/otps/email/discovery/authenticate', request, headers)
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
238
543
|
end
|
239
544
|
end
|
data/lib/stytch/b2b_passwords.rb
CHANGED
@@ -11,7 +11,7 @@ require_relative 'request_helper'
|
|
11
11
|
module StytchB2B
|
12
12
|
class Passwords
|
13
13
|
include Stytch::RequestHelper
|
14
|
-
attr_reader :email, :sessions, :existing_password
|
14
|
+
attr_reader :email, :sessions, :existing_password, :discovery
|
15
15
|
|
16
16
|
def initialize(connection)
|
17
17
|
@connection = connection
|
@@ -19,6 +19,7 @@ module StytchB2B
|
|
19
19
|
@email = StytchB2B::Passwords::Email.new(@connection)
|
20
20
|
@sessions = StytchB2B::Passwords::Sessions.new(@connection)
|
21
21
|
@existing_password = StytchB2B::Passwords::ExistingPassword.new(@connection)
|
22
|
+
@discovery = StytchB2B::Passwords::Discovery.new(@connection)
|
22
23
|
end
|
23
24
|
|
24
25
|
# This API allows you to check whether the user’s provided password is valid, and to provide feedback to the user on how to increase the strength of their password.
|
@@ -327,6 +328,25 @@ module StytchB2B
|
|
327
328
|
end
|
328
329
|
|
329
330
|
class Email
|
331
|
+
class RequireResetRequestOptions
|
332
|
+
# Optional authorization object.
|
333
|
+
# Pass in an active Stytch Member session token or session JWT and the request
|
334
|
+
# will be run using that member's permissions.
|
335
|
+
attr_accessor :authorization
|
336
|
+
|
337
|
+
def initialize(
|
338
|
+
authorization: nil
|
339
|
+
)
|
340
|
+
@authorization = authorization
|
341
|
+
end
|
342
|
+
|
343
|
+
def to_headers
|
344
|
+
headers = {}
|
345
|
+
headers.merge!(@authorization.to_headers) if authorization
|
346
|
+
headers
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
330
350
|
include Stytch::RequestHelper
|
331
351
|
|
332
352
|
def initialize(connection)
|
@@ -551,19 +571,51 @@ module StytchB2B
|
|
551
571
|
post_request('/v1/b2b/passwords/email/reset', request, headers)
|
552
572
|
end
|
553
573
|
|
554
|
-
|
574
|
+
# Require a password be reset by the associated email address. This endpoint is only functional for cross-org password use cases.
|
575
|
+
#
|
576
|
+
# == Parameters:
|
577
|
+
# email_address::
|
578
|
+
# The email address of the Member to start the email reset process for.
|
579
|
+
# The type of this field is +String+.
|
580
|
+
# organization_id::
|
581
|
+
# 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.
|
582
|
+
# The type of this field is nilable +String+.
|
583
|
+
# member_id::
|
584
|
+
# 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.
|
585
|
+
# The type of this field is nilable +String+.
|
586
|
+
#
|
587
|
+
# == Returns:
|
588
|
+
# An object with the following fields:
|
589
|
+
# member::
|
590
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object)
|
591
|
+
# The type of this field is +Member+ (+object+).
|
592
|
+
# organization::
|
593
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
594
|
+
# The type of this field is +Organization+ (+object+).
|
595
|
+
# status_code::
|
596
|
+
# 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.
|
597
|
+
# The type of this field is +Integer+.
|
598
|
+
# member_id::
|
599
|
+
# Globally unique UUID that identifies a specific Member.
|
600
|
+
# The type of this field is nilable +String+.
|
601
|
+
#
|
602
|
+
# == Method Options:
|
603
|
+
# This method supports an optional +StytchB2B::Passwords::Email::RequireResetRequestOptions+ object which will modify the headers sent in the HTTP request.
|
604
|
+
def require_reset(
|
555
605
|
email_address:,
|
556
606
|
organization_id: nil,
|
557
|
-
member_id: nil
|
607
|
+
member_id: nil,
|
608
|
+
method_options: nil
|
558
609
|
)
|
559
610
|
headers = {}
|
611
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
560
612
|
request = {
|
561
613
|
email_address: email_address
|
562
614
|
}
|
563
615
|
request[:organization_id] = organization_id unless organization_id.nil?
|
564
616
|
request[:member_id] = member_id unless member_id.nil?
|
565
617
|
|
566
|
-
post_request('/v1/b2b/passwords/email/
|
618
|
+
post_request('/v1/b2b/passwords/email/require_reset', request, headers)
|
567
619
|
end
|
568
620
|
end
|
569
621
|
|
@@ -810,5 +862,199 @@ module StytchB2B
|
|
810
862
|
post_request('/v1/b2b/passwords/existing_password/reset', request, headers)
|
811
863
|
end
|
812
864
|
end
|
865
|
+
|
866
|
+
class Discovery
|
867
|
+
include Stytch::RequestHelper
|
868
|
+
attr_reader :email
|
869
|
+
|
870
|
+
def initialize(connection)
|
871
|
+
@connection = connection
|
872
|
+
|
873
|
+
@email = StytchB2B::Passwords::Discovery::Email.new(@connection)
|
874
|
+
end
|
875
|
+
|
876
|
+
# Authenticate an email/password combination in the discovery flow. This authenticate flow is only valid for cross-org passwords use cases, and is not tied to a specific organization.
|
877
|
+
#
|
878
|
+
# 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.
|
879
|
+
#
|
880
|
+
# If successful, this endpoint will create a new intermediate session and return a list of discovered organizations that can be session exchanged into.
|
881
|
+
#
|
882
|
+
# == Parameters:
|
883
|
+
# email_address::
|
884
|
+
# The email address of the Member.
|
885
|
+
# The type of this field is +String+.
|
886
|
+
# password::
|
887
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characers, etc.
|
888
|
+
# The type of this field is +String+.
|
889
|
+
#
|
890
|
+
# == Returns:
|
891
|
+
# An object with the following fields:
|
892
|
+
# request_id::
|
893
|
+
# 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.
|
894
|
+
# The type of this field is +String+.
|
895
|
+
# email_address::
|
896
|
+
# The email address.
|
897
|
+
# The type of this field is +String+.
|
898
|
+
# intermediate_session_token::
|
899
|
+
# The returned Intermediate Session Token contains a password factor associated with the Member. If this value is non-empty, the member must complete an MFA step to finish logging in to the Organization. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. Password factors are not transferable between Organizations, so the intermediate session token is not valid for use with discovery endpoints.
|
900
|
+
# The type of this field is +String+.
|
901
|
+
# discovered_organizations::
|
902
|
+
# An array of `discovered_organization` objects tied to the `intermediate_session_token`, `session_token`, or `session_jwt`. See the [Discovered Organization Object](https://stytch.com/docs/b2b/api/discovered-organization-object) for complete details.
|
903
|
+
#
|
904
|
+
# Note that Organizations will only appear here under any of the following conditions:
|
905
|
+
# 1. The end user is already a Member of the Organization.
|
906
|
+
# 2. The end user is invited to the Organization.
|
907
|
+
# 3. The end user can join the Organization because:
|
908
|
+
#
|
909
|
+
# a) The Organization allows JIT provisioning.
|
910
|
+
#
|
911
|
+
# b) The Organizations' allowed domains list contains the Member's email domain.
|
912
|
+
#
|
913
|
+
# c) The Organization has at least one other Member with a verified email address with the same domain as the end user (to prevent phishing attacks).
|
914
|
+
# The type of this field is list of +DiscoveredOrganization+ (+object+).
|
915
|
+
# status_code::
|
916
|
+
# 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.
|
917
|
+
# The type of this field is +Integer+.
|
918
|
+
def authenticate(
|
919
|
+
email_address:,
|
920
|
+
password:
|
921
|
+
)
|
922
|
+
headers = {}
|
923
|
+
request = {
|
924
|
+
email_address: email_address,
|
925
|
+
password: password
|
926
|
+
}
|
927
|
+
|
928
|
+
post_request('/v1/b2b/passwords/discovery/authenticate', request, headers)
|
929
|
+
end
|
930
|
+
|
931
|
+
class Email
|
932
|
+
include Stytch::RequestHelper
|
933
|
+
|
934
|
+
def initialize(connection)
|
935
|
+
@connection = connection
|
936
|
+
end
|
937
|
+
|
938
|
+
# Initiates a password reset for the email address provided, when cross-org passwords are enabled. This will trigger an email to be sent to the address, containing a magic link that will allow them to set a new password and authenticate.
|
939
|
+
#
|
940
|
+
# This endpoint adapts to your Project's password strength configuration.
|
941
|
+
# If you're using [zxcvbn](https://stytch.com/docs/guides/passwords/strength-policy), the default, your passwords are considered valid
|
942
|
+
# if the strength score is >= 3. If you're using [LUDS](https://stytch.com/docs/guides/passwords/strength-policy), your passwords are
|
943
|
+
# considered valid if they meet the requirements that you've set with Stytch.
|
944
|
+
# You may update your password strength configuration in the [stytch dashboard](https://stytch.com/dashboard/password-strength-config).
|
945
|
+
#
|
946
|
+
# == Parameters:
|
947
|
+
# email_address::
|
948
|
+
# The email address of the Member to start the email reset process for.
|
949
|
+
# The type of this field is +String+.
|
950
|
+
# reset_password_redirect_url::
|
951
|
+
# The URL that the Member clicks from the reset password link. This URL should be an endpoint in the backend server that verifies the request by querying
|
952
|
+
# Stytch's authenticate endpoint and finishes the reset password flow. If this value is not passed, the default `reset_password_redirect_url` that you set in your Dashboard is used.
|
953
|
+
# If you have not set a default `reset_password_redirect_url`, an error is returned.
|
954
|
+
# The type of this field is nilable +String+.
|
955
|
+
# discovery_redirect_url::
|
956
|
+
# The URL that the end user clicks from the discovery Magic Link. This URL should be an endpoint in the backend server that
|
957
|
+
# verifies the request by querying Stytch's discovery authenticate endpoint and continues the flow. If this value is not passed, the default
|
958
|
+
# discovery redirect URL that you set in your Dashboard is used. If you have not set a default discovery redirect URL, an error is returned.
|
959
|
+
# The type of this field is nilable +String+.
|
960
|
+
# reset_password_template_id::
|
961
|
+
# Use a custom template for reset password emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic Links - Reset Password.
|
962
|
+
# The type of this field is nilable +String+.
|
963
|
+
# reset_password_expiration_minutes::
|
964
|
+
# Sets a time limit after which the email link to reset the member's password will no longer be valid.
|
965
|
+
# The type of this field is nilable +Integer+.
|
966
|
+
# pkce_code_challenge::
|
967
|
+
# (no documentation yet)
|
968
|
+
# The type of this field is nilable +String+.
|
969
|
+
# locale::
|
970
|
+
# 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"`.
|
971
|
+
#
|
972
|
+
# Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
|
973
|
+
#
|
974
|
+
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
|
975
|
+
#
|
976
|
+
# The type of this field is nilable +String+.
|
977
|
+
#
|
978
|
+
# == Returns:
|
979
|
+
# An object with the following fields:
|
980
|
+
# request_id::
|
981
|
+
# 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.
|
982
|
+
# The type of this field is +String+.
|
983
|
+
# status_code::
|
984
|
+
# 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.
|
985
|
+
# The type of this field is +Integer+.
|
986
|
+
def reset_start(
|
987
|
+
email_address:,
|
988
|
+
reset_password_redirect_url: nil,
|
989
|
+
discovery_redirect_url: nil,
|
990
|
+
reset_password_template_id: nil,
|
991
|
+
reset_password_expiration_minutes: nil,
|
992
|
+
pkce_code_challenge: nil,
|
993
|
+
locale: nil
|
994
|
+
)
|
995
|
+
headers = {}
|
996
|
+
request = {
|
997
|
+
email_address: email_address
|
998
|
+
}
|
999
|
+
request[:reset_password_redirect_url] = reset_password_redirect_url unless reset_password_redirect_url.nil?
|
1000
|
+
request[:discovery_redirect_url] = discovery_redirect_url unless discovery_redirect_url.nil?
|
1001
|
+
request[:reset_password_template_id] = reset_password_template_id unless reset_password_template_id.nil?
|
1002
|
+
request[:reset_password_expiration_minutes] = reset_password_expiration_minutes unless reset_password_expiration_minutes.nil?
|
1003
|
+
request[:pkce_code_challenge] = pkce_code_challenge unless pkce_code_challenge.nil?
|
1004
|
+
request[:locale] = locale unless locale.nil?
|
1005
|
+
|
1006
|
+
post_request('/v1/b2b/passwords/discovery/email/reset/start', request, headers)
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
# Reset the password associated with an email and start an intermediate session. This endpoint checks that the password reset token is valid, hasn’t expired, or already been used.
|
1010
|
+
#
|
1011
|
+
# The provided password needs to meet the project's 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.
|
1012
|
+
#
|
1013
|
+
# Resetting a password will start an intermediate session and return a list of discovered organizations the session can be exchanged into.
|
1014
|
+
#
|
1015
|
+
# == Parameters:
|
1016
|
+
# password_reset_token::
|
1017
|
+
# The password reset token to authenticate.
|
1018
|
+
# The type of this field is +String+.
|
1019
|
+
# password::
|
1020
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characers, etc.
|
1021
|
+
# The type of this field is +String+.
|
1022
|
+
# pkce_code_verifier::
|
1023
|
+
# (no documentation yet)
|
1024
|
+
# The type of this field is nilable +String+.
|
1025
|
+
#
|
1026
|
+
# == Returns:
|
1027
|
+
# An object with the following fields:
|
1028
|
+
# request_id::
|
1029
|
+
# 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.
|
1030
|
+
# The type of this field is +String+.
|
1031
|
+
# intermediate_session_token::
|
1032
|
+
# The returned Intermediate Session Token contains a password factor associated with the Member. If this value is non-empty, the member must complete an MFA step to finish logging in to the Organization. The token can be used with 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), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. Password factors are not transferable between Organizations, so the intermediate session token is not valid for use with discovery endpoints.
|
1033
|
+
# The type of this field is +String+.
|
1034
|
+
# email_address::
|
1035
|
+
# (no documentation yet)
|
1036
|
+
# The type of this field is +String+.
|
1037
|
+
# discovered_organizations::
|
1038
|
+
# (no documentation yet)
|
1039
|
+
# The type of this field is list of +DiscoveredOrganization+ (+object+).
|
1040
|
+
# status_code::
|
1041
|
+
# 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.
|
1042
|
+
# The type of this field is +Integer+.
|
1043
|
+
def reset(
|
1044
|
+
password_reset_token:,
|
1045
|
+
password:,
|
1046
|
+
pkce_code_verifier: nil
|
1047
|
+
)
|
1048
|
+
headers = {}
|
1049
|
+
request = {
|
1050
|
+
password_reset_token: password_reset_token,
|
1051
|
+
password: password
|
1052
|
+
}
|
1053
|
+
request[:pkce_code_verifier] = pkce_code_verifier unless pkce_code_verifier.nil?
|
1054
|
+
|
1055
|
+
post_request('/v1/b2b/passwords/discovery/email/reset', request, headers)
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
end
|
813
1059
|
end
|
814
1060
|
end
|
data/lib/stytch/b2b_sso.rb
CHANGED
@@ -311,7 +311,9 @@ module StytchB2B
|
|
311
311
|
# A human-readable display name for the connection.
|
312
312
|
# The type of this field is nilable +String+.
|
313
313
|
# identity_provider::
|
314
|
-
#
|
314
|
+
# Name of the IdP. Enum with possible values: `classlink`, `cyberark`, `duo`, `google-workspace`, `jumpcloud`, `keycloak`, `miniorange`, `microsoft-entra`, `okta`, `onelogin`, `pingfederate`, `rippling`, `salesforce`, `shibboleth`, or `generic`.
|
315
|
+
#
|
316
|
+
# Specifying a known provider allows Stytch to handle any provider-specific logic.
|
315
317
|
# The type of this field is nilable +CreateConnectionRequestIdentityProvider+ (string enum).
|
316
318
|
#
|
317
319
|
# == Returns:
|
@@ -394,7 +396,9 @@ module StytchB2B
|
|
394
396
|
# The location of the IdP's JSON Web Key Set, used to verify credentials issued by the IdP. This will be provided by the IdP.
|
395
397
|
# The type of this field is nilable +String+.
|
396
398
|
# identity_provider::
|
397
|
-
#
|
399
|
+
# Name of the IdP. Enum with possible values: `classlink`, `cyberark`, `duo`, `google-workspace`, `jumpcloud`, `keycloak`, `miniorange`, `microsoft-entra`, `okta`, `onelogin`, `pingfederate`, `rippling`, `salesforce`, `shibboleth`, or `generic`.
|
400
|
+
#
|
401
|
+
# Specifying a known provider allows Stytch to handle any provider-specific logic.
|
398
402
|
# The type of this field is nilable +UpdateConnectionRequestIdentityProvider+ (string enum).
|
399
403
|
# custom_scopes::
|
400
404
|
# Include a space-separated list of custom scopes that you'd like to include. Note that this list must be URL encoded, e.g. the spaces must be expressed as %20.
|
@@ -548,7 +552,9 @@ module StytchB2B
|
|
548
552
|
# A human-readable display name for the connection.
|
549
553
|
# The type of this field is nilable +String+.
|
550
554
|
# identity_provider::
|
551
|
-
#
|
555
|
+
# Name of the IdP. Enum with possible values: `classlink`, `cyberark`, `duo`, `google-workspace`, `jumpcloud`, `keycloak`, `miniorange`, `microsoft-entra`, `okta`, `onelogin`, `pingfederate`, `rippling`, `salesforce`, `shibboleth`, or `generic`.
|
556
|
+
#
|
557
|
+
# Specifying a known provider allows Stytch to handle any provider-specific logic.
|
552
558
|
# The type of this field is nilable +CreateConnectionRequestIdentityProvider+ (string enum).
|
553
559
|
#
|
554
560
|
# == Returns:
|
@@ -617,15 +623,16 @@ module StytchB2B
|
|
617
623
|
# Defines the names of the SAML groups
|
618
624
|
# that grant specific role assignments. For each group-Role pair, if a Member logs in with this SAML connection and
|
619
625
|
# belongs to the specified SAML group, they will be granted the associated Role. See the
|
620
|
-
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment.
|
621
|
-
# Before adding any group implicit role assignments, you must add a "groups" key to your SAML connection's
|
626
|
+
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. Before adding any group implicit role assignments, you must add a "groups" key to your SAML connection's
|
622
627
|
# `attribute_mapping`. Make sure that your IdP is configured to correctly send the group information.
|
623
628
|
# The type of this field is nilable list of +SAMLGroupImplicitRoleAssignment+.
|
624
629
|
# alternative_audience_uri::
|
625
630
|
# An alternative URL to use for the Audience Restriction. This value can be used when you wish to migrate an existing SAML integration to Stytch with zero downtime. Read our [SSO migration guide](https://stytch.com/docs/b2b/guides/migrations/additional-migration-considerations) for more info.
|
626
631
|
# The type of this field is nilable +String+.
|
627
632
|
# identity_provider::
|
628
|
-
#
|
633
|
+
# Name of the IdP. Enum with possible values: `classlink`, `cyberark`, `duo`, `google-workspace`, `jumpcloud`, `keycloak`, `miniorange`, `microsoft-entra`, `okta`, `onelogin`, `pingfederate`, `rippling`, `salesforce`, `shibboleth`, or `generic`.
|
634
|
+
#
|
635
|
+
# Specifying a known provider allows Stytch to handle any provider-specific logic.
|
629
636
|
# The type of this field is nilable +UpdateConnectionRequestIdentityProvider+ (string enum).
|
630
637
|
#
|
631
638
|
# == Returns:
|
@@ -877,14 +884,13 @@ module StytchB2B
|
|
877
884
|
# A human-readable display name for the connection.
|
878
885
|
# The type of this field is nilable +String+.
|
879
886
|
# external_connection_implicit_role_assignments::
|
880
|
-
# All Members who log in with this External connection will implicitly receive the specified Roles. See the [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment.Implicit role assignments are not supported for External connections if the underlying SSO connection is an OIDC connection.
|
887
|
+
# All Members who log in with this External connection will implicitly receive the specified Roles. See the [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. Implicit role assignments are not supported for External connections if the underlying SSO connection is an OIDC connection.
|
881
888
|
# The type of this field is nilable list of +ConnectionImplicitRoleAssignment+.
|
882
889
|
# external_group_implicit_role_assignments::
|
883
890
|
# Defines the names of the groups
|
884
891
|
# that grant specific role assignments. For each group-Role pair, if a Member logs in with this external connection and
|
885
892
|
# belongs to the specified group, they will be granted the associated Role. See the
|
886
|
-
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment.
|
887
|
-
# Before adding any group implicit role assignments to an external connection, you must add a "groups" key to the underlying SAML connection's
|
893
|
+
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. Before adding any group implicit role assignments to an external connection, you must add a "groups" key to the underlying SAML connection's
|
888
894
|
# `attribute_mapping`. Make sure that the SAML connection IdP is configured to correctly send the group information. Implicit role assignments are not supported
|
889
895
|
# for External connections if the underlying SSO connection is an OIDC connection.
|
890
896
|
# The type of this field is nilable list of +GroupImplicitRoleAssignment+.
|
data/lib/stytch/m2m.rb
CHANGED
@@ -75,6 +75,7 @@ module Stytch
|
|
75
75
|
# The type of the returned access token. Today, this value will always be equal to "bearer"
|
76
76
|
# The type of this field is +String+.
|
77
77
|
def token(client_id:, client_secret:, scopes: nil)
|
78
|
+
headers = {}
|
78
79
|
request = {
|
79
80
|
grant_type: 'client_credentials',
|
80
81
|
client_id: client_id,
|
@@ -82,7 +83,7 @@ module Stytch
|
|
82
83
|
}
|
83
84
|
request[:scope] = scopes.join(' ') unless scopes.nil?
|
84
85
|
|
85
|
-
JSON.parse(post_request("/v1/public/#{@project_id}/oauth2/token", request), { symbolize_names: true })
|
86
|
+
JSON.parse(post_request("/v1/public/#{@project_id}/oauth2/token", request, headers), { symbolize_names: true })
|
86
87
|
end
|
87
88
|
# ENDMANUAL(M2M::token)
|
88
89
|
|
data/lib/stytch/otps.rb
CHANGED
@@ -485,10 +485,10 @@ module Stytch
|
|
485
485
|
# The `session_jwt` associated with a User's existing Session.
|
486
486
|
# The type of this field is nilable +String+.
|
487
487
|
# login_template_id::
|
488
|
-
# Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for
|
488
|
+
# Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for OTP - Login.
|
489
489
|
# The type of this field is nilable +String+.
|
490
490
|
# signup_template_id::
|
491
|
-
# Use a custom template for sign-up emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for
|
491
|
+
# Use a custom template for sign-up emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for OTP - Sign-up.
|
492
492
|
# The type of this field is nilable +String+.
|
493
493
|
#
|
494
494
|
# == Returns:
|
data/lib/stytch/users.rb
CHANGED
@@ -156,7 +156,15 @@ module Stytch
|
|
156
156
|
get_request(request, headers)
|
157
157
|
end
|
158
158
|
|
159
|
-
# Search for Users within your Stytch Project.
|
159
|
+
# Search for Users within your Stytch Project.
|
160
|
+
#
|
161
|
+
# Use the `query` object to filter by different fields. See the `query.operands.filter_value` documentation below for a list of available filters.
|
162
|
+
#
|
163
|
+
# ### Export all User data
|
164
|
+
#
|
165
|
+
# Submit an empty `query` in your Search Users request to return all of your Stytch Project's Users.
|
166
|
+
#
|
167
|
+
# [This Github repository](https://github.com/stytchauth/stytch-node-export-users) contains a utility that leverages the Search Users endpoint to export all of your User data to a CSV or JSON file.
|
160
168
|
#
|
161
169
|
# == Parameters:
|
162
170
|
# cursor::
|
data/lib/stytch/version.rb
CHANGED
data/lib/stytch/webauthn.rb
CHANGED
@@ -41,6 +41,15 @@ module Stytch
|
|
41
41
|
# If true, the `public_key_credential_creation_options` returned will be optimized for Passkeys with `residentKey` set to `"required"` and `userVerification` set to `"preferred"`.
|
42
42
|
#
|
43
43
|
# The type of this field is nilable +Boolean+.
|
44
|
+
# override_id::
|
45
|
+
# (no documentation yet)
|
46
|
+
# The type of this field is nilable +String+.
|
47
|
+
# override_name::
|
48
|
+
# (no documentation yet)
|
49
|
+
# The type of this field is nilable +String+.
|
50
|
+
# override_display_name::
|
51
|
+
# (no documentation yet)
|
52
|
+
# The type of this field is nilable +String+.
|
44
53
|
#
|
45
54
|
# == Returns:
|
46
55
|
# An object with the following fields:
|
@@ -61,7 +70,10 @@ module Stytch
|
|
61
70
|
domain:,
|
62
71
|
user_agent: nil,
|
63
72
|
authenticator_type: nil,
|
64
|
-
return_passkey_credential_options: nil
|
73
|
+
return_passkey_credential_options: nil,
|
74
|
+
override_id: nil,
|
75
|
+
override_name: nil,
|
76
|
+
override_display_name: nil
|
65
77
|
)
|
66
78
|
headers = {}
|
67
79
|
request = {
|
@@ -71,6 +83,9 @@ module Stytch
|
|
71
83
|
request[:user_agent] = user_agent unless user_agent.nil?
|
72
84
|
request[:authenticator_type] = authenticator_type unless authenticator_type.nil?
|
73
85
|
request[:return_passkey_credential_options] = return_passkey_credential_options unless return_passkey_credential_options.nil?
|
86
|
+
request[:override_id] = override_id unless override_id.nil?
|
87
|
+
request[:override_name] = override_name unless override_name.nil?
|
88
|
+
request[:override_display_name] = override_display_name unless override_display_name.nil?
|
74
89
|
|
75
90
|
post_request('/v1/webauthn/register/start', request, headers)
|
76
91
|
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: 9.
|
4
|
+
version: 9.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 2.24.0
|
103
|
-
description:
|
103
|
+
description:
|
104
104
|
email:
|
105
105
|
- support@stytch.com
|
106
106
|
executables: []
|
@@ -162,7 +162,7 @@ licenses:
|
|
162
162
|
metadata:
|
163
163
|
homepage_uri: https://stytch.com
|
164
164
|
source_code_uri: https://github.com/stytchauth/stytch-ruby
|
165
|
-
post_install_message:
|
165
|
+
post_install_message:
|
166
166
|
rdoc_options: []
|
167
167
|
require_paths:
|
168
168
|
- lib
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
180
|
rubygems_version: 3.2.3
|
181
|
-
signing_key:
|
181
|
+
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: Stytch Ruby Gem
|
184
184
|
test_files: []
|