stytch 9.5.0 → 9.7.0
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 +10 -6
- data/lib/stytch/b2b_magic_links.rb +7 -7
- data/lib/stytch/b2b_oauth.rb +8 -5
- data/lib/stytch/b2b_organizations.rb +24 -11
- data/lib/stytch/b2b_otp.rb +2 -2
- data/lib/stytch/b2b_passwords.rb +23 -8
- data/lib/stytch/b2b_recovery_codes.rb +3 -3
- data/lib/stytch/b2b_sessions.rb +5 -4
- data/lib/stytch/b2b_sso.rb +13 -3
- data/lib/stytch/b2b_totps.rb +2 -2
- data/lib/stytch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2234d80bb5d7d5fa35a2f270fb6edf74d42e8f23a75751f5eba3942cf6fa3b3a
|
4
|
+
data.tar.gz: 90df59d4eac45d2ffa9b4156c040d30dc0ea4ba852db24be010a0247825ef772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cdcc7b6d7e4aacdf2f912f9fd253bb81be8f53e262a7d8ddd380f8c83610895c29c2ecbd87870b8edff04ca7d5f0d047c86215a74d78afec0d4372659f3c4e5
|
7
|
+
data.tar.gz: 0b321be206d3cb41a31806b9893dfb67405a098f42b950fb456f55d16ae0a12d7c73455391cafb2f3177aef87f4142e9be3293c963b0f5660fd7cbab3c6f8a2c
|
data/lib/stytch/b2b_discovery.rb
CHANGED
@@ -32,12 +32,16 @@ module StytchB2B
|
|
32
32
|
#
|
33
33
|
# This endpoint can be used to accept invites and create new members via domain matching.
|
34
34
|
#
|
35
|
-
# If the
|
35
|
+
# If the is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`.
|
36
36
|
# The `intermediate_session_token` will not be consumed and instead will be returned in the response.
|
37
37
|
# 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.
|
38
38
|
# 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.
|
39
39
|
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
40
40
|
#
|
41
|
+
# If the Member is logging in via an OAuth provider that does not fully verify the email, the returned value of `member_authenticated` will be `false`.
|
42
|
+
# The `intermediate_session_token` will not be consumed and instead will be returned in the response.
|
43
|
+
# The `primary_required` field details the authentication flow the Member must perform in order to [complete a step-up authentication](https://stytch.com/docs/b2b/guides/oauth/auth-flows) into the organization. The `intermediate_session_token` must be passed into that authentication flow.
|
44
|
+
#
|
41
45
|
# == Parameters:
|
42
46
|
# intermediate_session_token::
|
43
47
|
# 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.
|
@@ -64,7 +68,7 @@ module StytchB2B
|
|
64
68
|
# Total custom claims size cannot exceed four kilobytes.
|
65
69
|
# The type of this field is nilable +object+.
|
66
70
|
# locale::
|
67
|
-
# If the
|
71
|
+
# If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
|
68
72
|
#
|
69
73
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
70
74
|
#
|
@@ -110,7 +114,7 @@ module StytchB2B
|
|
110
114
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
111
115
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
112
116
|
# primary_required::
|
113
|
-
#
|
117
|
+
# Information about the primary authentication requirements of the Organization.
|
114
118
|
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
115
119
|
def exchange(
|
116
120
|
intermediate_session_token:,
|
@@ -139,14 +143,14 @@ module StytchB2B
|
|
139
143
|
@connection = connection
|
140
144
|
end
|
141
145
|
|
142
|
-
# If an end user does not want to join any already-existing
|
146
|
+
# If an end user does not want to join any already-existing, or has no possible Organizations to join, this endpoint can be used to create a new
|
143
147
|
# [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object).
|
144
148
|
#
|
145
149
|
# This operation consumes the Intermediate Session.
|
146
150
|
#
|
147
151
|
# This endpoint will also create an initial Member Session for the newly created Member.
|
148
152
|
#
|
149
|
-
# The
|
153
|
+
# The created by this endpoint will automatically be granted the `stytch_admin` Role. See the
|
150
154
|
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/stytch-default) for more details on this Role.
|
151
155
|
#
|
152
156
|
# If the new Organization is created with a `mfa_policy` of `REQUIRED_FOR_ALL`, the newly created Member will need to complete an MFA step to log in to the Organization.
|
@@ -311,7 +315,7 @@ module StytchB2B
|
|
311
315
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
312
316
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
313
317
|
# primary_required::
|
314
|
-
#
|
318
|
+
# Information about the primary authentication requirements of the Organization.
|
315
319
|
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
316
320
|
def create(
|
317
321
|
intermediate_session_token:,
|
@@ -20,10 +20,10 @@ module StytchB2B
|
|
20
20
|
@discovery = StytchB2B::MagicLinks::Discovery.new(@connection)
|
21
21
|
end
|
22
22
|
|
23
|
-
# Authenticate a
|
23
|
+
# Authenticate a with a Magic Link. This endpoint requires a Magic Link token that is not expired or previously used. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
|
24
24
|
# Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
|
25
25
|
#
|
26
|
-
# If the Member is required to complete MFA to log in to the
|
26
|
+
# If the Member is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
|
27
27
|
# The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp),
|
28
28
|
# or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete the MFA step and acquire a full member session.
|
29
29
|
# The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
|
@@ -67,7 +67,7 @@ module StytchB2B
|
|
67
67
|
# Total custom claims size cannot exceed four kilobytes.
|
68
68
|
# The type of this field is nilable +object+.
|
69
69
|
# locale::
|
70
|
-
# If the
|
70
|
+
# If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
|
71
71
|
#
|
72
72
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
73
73
|
#
|
@@ -107,9 +107,6 @@ module StytchB2B
|
|
107
107
|
# session_jwt::
|
108
108
|
# The JSON Web Token (JWT) for a given Stytch Session.
|
109
109
|
# The type of this field is +String+.
|
110
|
-
# member_session::
|
111
|
-
# The [Session object](https://stytch.com/docs/b2b/api/session-object).
|
112
|
-
# The type of this field is +MemberSession+ (+object+).
|
113
110
|
# organization::
|
114
111
|
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
115
112
|
# The type of this field is +Organization+ (+object+).
|
@@ -122,6 +119,9 @@ module StytchB2B
|
|
122
119
|
# status_code::
|
123
120
|
# 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.
|
124
121
|
# The type of this field is +Integer+.
|
122
|
+
# member_session::
|
123
|
+
# The [Session object](https://stytch.com/docs/b2b/api/session-object).
|
124
|
+
# The type of this field is nilable +MemberSession+ (+object+).
|
125
125
|
# mfa_required::
|
126
126
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
127
127
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
@@ -265,7 +265,7 @@ module StytchB2B
|
|
265
265
|
post_request('/v1/b2b/magic_links/email/login_or_signup', request, headers)
|
266
266
|
end
|
267
267
|
|
268
|
-
# Send an invite email to a new
|
268
|
+
# Send an invite email to a new to join an. The Member will be created with an `invited` status until they successfully authenticate. Sending invites to `pending` Members will update their status to `invited`. Sending invites to already `active` Members will return an error.
|
269
269
|
#
|
270
270
|
# The magic link invite will be valid for 1 week.
|
271
271
|
#
|
data/lib/stytch/b2b_oauth.rb
CHANGED
@@ -19,15 +19,18 @@ module StytchB2B
|
|
19
19
|
@discovery = StytchB2B::OAuth::Discovery.new(@connection)
|
20
20
|
end
|
21
21
|
|
22
|
-
# Authenticate a
|
22
|
+
# Authenticate a given a `token`. This endpoint verifies that the member completed the flow by verifying that the token is valid and hasn't expired. Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
|
23
23
|
#
|
24
|
-
# If the Member is required to complete MFA to log in to the
|
24
|
+
# If the Member is required to complete MFA to log in to the, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
|
25
25
|
# The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.
|
26
26
|
# The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
|
27
27
|
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
28
28
|
#
|
29
29
|
# If a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step.
|
30
30
|
#
|
31
|
+
# If the Member is logging in via an OAuth provider that does not fully verify the email, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
|
32
|
+
# The `primary_required` field details the authentication flow the Member must perform in order to [complete a step-up authentication](https://stytch.com/docs/b2b/guides/oauth/auth-flows) into the organization. The `intermediate_session_token` must be passed into that authentication flow.
|
33
|
+
#
|
31
34
|
# We’re actively accepting requests for new OAuth providers! Please [email us](mailto:support@stytch.com) or [post in our community](https://stytch.com/docs/b2b/resources) if you are looking for an OAuth provider that is not currently supported.
|
32
35
|
#
|
33
36
|
# == Parameters:
|
@@ -62,7 +65,7 @@ module StytchB2B
|
|
62
65
|
# A base64url encoded one time secret used to validate that the request starts and ends on the same device.
|
63
66
|
# The type of this field is nilable +String+.
|
64
67
|
# locale::
|
65
|
-
# If the
|
68
|
+
# If the needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
|
66
69
|
#
|
67
70
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
68
71
|
#
|
@@ -128,7 +131,7 @@ module StytchB2B
|
|
128
131
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
129
132
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
130
133
|
# primary_required::
|
131
|
-
#
|
134
|
+
# Information about the primary authentication requirements of the Organization.
|
132
135
|
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
133
136
|
def authenticate(
|
134
137
|
oauth_token:,
|
@@ -162,7 +165,7 @@ module StytchB2B
|
|
162
165
|
@connection = connection
|
163
166
|
end
|
164
167
|
|
165
|
-
# Authenticates the Discovery
|
168
|
+
# Authenticates the Discovery token and exchanges it for an Intermediate Session Token. Intermediate Session Tokens can be used for various Discovery login flows and are valid for 10 minutes.
|
166
169
|
#
|
167
170
|
# == Parameters:
|
168
171
|
# discovery_oauth_token::
|
@@ -57,7 +57,7 @@ module StytchB2B
|
|
57
57
|
@members = StytchB2B::Organizations::Members.new(@connection)
|
58
58
|
end
|
59
59
|
|
60
|
-
# Creates an
|
60
|
+
# Creates an. An `organization_name` and a unique `organization_slug` are required.
|
61
61
|
#
|
62
62
|
# By default, `email_invites` and `sso_jit_provisioning` will be set to `ALL_ALLOWED`, and `mfa_policy` will be set to `OPTIONAL` if no Organization authentication settings are explicitly defined in the request.
|
63
63
|
#
|
@@ -214,7 +214,7 @@ module StytchB2B
|
|
214
214
|
post_request('/v1/b2b/organizations', request, headers)
|
215
215
|
end
|
216
216
|
|
217
|
-
# Returns an
|
217
|
+
# Returns an specified by `organization_id`.
|
218
218
|
#
|
219
219
|
# == Parameters:
|
220
220
|
# organization_id::
|
@@ -241,7 +241,7 @@ module StytchB2B
|
|
241
241
|
get_request(request, headers)
|
242
242
|
end
|
243
243
|
|
244
|
-
# Updates an
|
244
|
+
# 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.
|
245
245
|
#
|
246
246
|
# *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.
|
247
247
|
#
|
@@ -451,7 +451,7 @@ module StytchB2B
|
|
451
451
|
put_request("/v1/b2b/organizations/#{organization_id}", request, headers)
|
452
452
|
end
|
453
453
|
|
454
|
-
# Deletes an
|
454
|
+
# Deletes an specified by `organization_id`. All Members of the Organization will also be deleted.
|
455
455
|
#
|
456
456
|
# == Parameters:
|
457
457
|
# organization_id::
|
@@ -712,7 +712,7 @@ module StytchB2B
|
|
712
712
|
@oauth_providers = StytchB2B::Organizations::Members::OAuthProviders.new(@connection)
|
713
713
|
end
|
714
714
|
|
715
|
-
# Updates a
|
715
|
+
# Updates a specified by `organization_id` and `member_id`.
|
716
716
|
#
|
717
717
|
# == Parameters:
|
718
718
|
# organization_id::
|
@@ -835,7 +835,7 @@ module StytchB2B
|
|
835
835
|
put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request, headers)
|
836
836
|
end
|
837
837
|
|
838
|
-
# Deletes a
|
838
|
+
# Deletes a specified by `organization_id` and `member_id`.
|
839
839
|
#
|
840
840
|
# == Parameters:
|
841
841
|
# organization_id::
|
@@ -869,7 +869,7 @@ module StytchB2B
|
|
869
869
|
delete_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", headers)
|
870
870
|
end
|
871
871
|
|
872
|
-
# Reactivates a deleted
|
872
|
+
# 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`.
|
873
873
|
#
|
874
874
|
# == Parameters:
|
875
875
|
# organization_id::
|
@@ -911,7 +911,7 @@ module StytchB2B
|
|
911
911
|
put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/reactivate", request, headers)
|
912
912
|
end
|
913
913
|
|
914
|
-
# Delete a
|
914
|
+
# Delete a's MFA phone number.
|
915
915
|
#
|
916
916
|
# To change a Member's phone number, you must first call this endpoint to delete the existing phone number.
|
917
917
|
#
|
@@ -1058,7 +1058,7 @@ module StytchB2B
|
|
1058
1058
|
post_request('/v1/b2b/organizations/members/search', request, headers)
|
1059
1059
|
end
|
1060
1060
|
|
1061
|
-
# Delete a
|
1061
|
+
# Delete a's password.
|
1062
1062
|
#
|
1063
1063
|
# == Parameters:
|
1064
1064
|
# organization_id::
|
@@ -1131,7 +1131,20 @@ module StytchB2B
|
|
1131
1131
|
get_request(request, headers)
|
1132
1132
|
end
|
1133
1133
|
|
1134
|
-
|
1134
|
+
def oidc_providers(
|
1135
|
+
organization_id:,
|
1136
|
+
member_id:,
|
1137
|
+
include_refresh_token: nil
|
1138
|
+
)
|
1139
|
+
headers = {}
|
1140
|
+
query_params = {
|
1141
|
+
include_refresh_token: include_refresh_token
|
1142
|
+
}
|
1143
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oidc_providers", query_params)
|
1144
|
+
get_request(request, headers)
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
# Unlinks a retired email address from a specified by their `organization_id` and `member_id`. The email address
|
1135
1148
|
# to be retired can be identified in the request body by either its `email_id`, its `email_address`, or both. If using
|
1136
1149
|
# both identifiers they must refer to the same email.
|
1137
1150
|
#
|
@@ -1199,7 +1212,7 @@ module StytchB2B
|
|
1199
1212
|
post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/unlink_retired_email", request, headers)
|
1200
1213
|
end
|
1201
1214
|
|
1202
|
-
# Creates a
|
1215
|
+
# Creates a. An `organization_id` and `email_address` are required.
|
1203
1216
|
#
|
1204
1217
|
# == Parameters:
|
1205
1218
|
# organization_id::
|
data/lib/stytch/b2b_otp.rb
CHANGED
@@ -26,7 +26,7 @@ module StytchB2B
|
|
26
26
|
@connection = connection
|
27
27
|
end
|
28
28
|
|
29
|
-
# Send a One-Time Passcode (OTP) to a
|
29
|
+
# Send a One-Time Passcode (OTP) to a's phone number.
|
30
30
|
#
|
31
31
|
# 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.
|
32
32
|
# 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.
|
@@ -125,7 +125,7 @@ module StytchB2B
|
|
125
125
|
# such as [email magic link authenticate](https://stytch.com/docs/b2b/api/authenticate-magic-link),
|
126
126
|
# 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).
|
127
127
|
#
|
128
|
-
# If the
|
128
|
+
# 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`.
|
129
129
|
# 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.
|
130
130
|
# The Member's MFA enrollment can also be toggled through the [Update Member](https://stytch.com/docs/b2b/api/update-member) endpoint.
|
131
131
|
#
|
data/lib/stytch/b2b_passwords.rb
CHANGED
@@ -99,7 +99,7 @@ module StytchB2B
|
|
99
99
|
# The password hash. For a Scrypt or PBKDF2 hash, the hash needs to be a base64 encoded string.
|
100
100
|
# The type of this field is +String+.
|
101
101
|
# hash_type::
|
102
|
-
# The password hash used. Currently `bcrypt`, `scrypt`, `
|
102
|
+
# The password hash used. Currently `bcrypt`, `scrypt`, `argon_2i`, `argon2_id`, `md_5`, `sha_1`, and `pbkdf_2` are supported.
|
103
103
|
# The type of this field is +MigrateRequestHashType+ (string enum).
|
104
104
|
# organization_id::
|
105
105
|
# 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.
|
@@ -207,7 +207,7 @@ module StytchB2B
|
|
207
207
|
#
|
208
208
|
# 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.
|
209
209
|
#
|
210
|
-
# If the
|
210
|
+
# 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.
|
211
211
|
# 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.
|
212
212
|
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
213
213
|
#
|
@@ -248,7 +248,7 @@ module StytchB2B
|
|
248
248
|
# Total custom claims size cannot exceed four kilobytes.
|
249
249
|
# The type of this field is nilable +object+.
|
250
250
|
# locale::
|
251
|
-
# If the
|
251
|
+
# 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.
|
252
252
|
#
|
253
253
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
254
254
|
#
|
@@ -419,7 +419,7 @@ module StytchB2B
|
|
419
419
|
post_request('/v1/b2b/passwords/email/reset/start', request, headers)
|
420
420
|
end
|
421
421
|
|
422
|
-
# Reset the
|
422
|
+
# Reset the's password and authenticate them. This endpoint checks that the password reset token is valid, hasn’t expired, or already been used.
|
423
423
|
#
|
424
424
|
# 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.
|
425
425
|
#
|
@@ -470,7 +470,7 @@ module StytchB2B
|
|
470
470
|
# Total custom claims size cannot exceed four kilobytes.
|
471
471
|
# The type of this field is nilable +object+.
|
472
472
|
# locale::
|
473
|
-
# If the
|
473
|
+
# 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.
|
474
474
|
#
|
475
475
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
476
476
|
#
|
@@ -550,6 +550,21 @@ module StytchB2B
|
|
550
550
|
|
551
551
|
post_request('/v1/b2b/passwords/email/reset', request, headers)
|
552
552
|
end
|
553
|
+
|
554
|
+
def delete(
|
555
|
+
email_address:,
|
556
|
+
organization_id: nil,
|
557
|
+
member_id: nil
|
558
|
+
)
|
559
|
+
headers = {}
|
560
|
+
request = {
|
561
|
+
email_address: email_address
|
562
|
+
}
|
563
|
+
request[:organization_id] = organization_id unless organization_id.nil?
|
564
|
+
request[:member_id] = member_id unless member_id.nil?
|
565
|
+
|
566
|
+
post_request('/v1/b2b/passwords/email/delete', request, headers)
|
567
|
+
end
|
553
568
|
end
|
554
569
|
|
555
570
|
class Sessions
|
@@ -559,7 +574,7 @@ module StytchB2B
|
|
559
574
|
@connection = connection
|
560
575
|
end
|
561
576
|
|
562
|
-
# Reset the
|
577
|
+
# 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.
|
563
578
|
#
|
564
579
|
# 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.
|
565
580
|
#
|
@@ -669,7 +684,7 @@ module StytchB2B
|
|
669
684
|
@connection = connection
|
670
685
|
end
|
671
686
|
|
672
|
-
# Reset the
|
687
|
+
# Reset the’s password using their existing password.
|
673
688
|
#
|
674
689
|
# This endpoint adapts to your Project's password strength configuration.
|
675
690
|
# If you're using [zxcvbn](https://stytch.com/docs/guides/passwords/strength-policy), the default, your passwords are considered valid
|
@@ -723,7 +738,7 @@ module StytchB2B
|
|
723
738
|
# Total custom claims size cannot exceed four kilobytes.
|
724
739
|
# The type of this field is nilable +object+.
|
725
740
|
# locale::
|
726
|
-
# If the
|
741
|
+
# 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.
|
727
742
|
#
|
728
743
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
729
744
|
#
|
@@ -16,7 +16,7 @@ module StytchB2B
|
|
16
16
|
@connection = connection
|
17
17
|
end
|
18
18
|
|
19
|
-
# Allows a
|
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.
|
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
|
113
|
+
# Returns a'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
|
153
|
+
# Rotate a'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
|
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.
|
95
95
|
# In addition, the `organization_id` passed in the authorization check must match the Member's Organization.
|
96
96
|
#
|
97
97
|
# If the Member is not authorized to perform the specified action on the specified Resource, or if the
|
@@ -229,13 +229,14 @@ module StytchB2B
|
|
229
229
|
post_request('/v1/b2b/sessions/revoke', request, headers)
|
230
230
|
end
|
231
231
|
|
232
|
-
# Use this endpoint to exchange a
|
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.
|
233
233
|
#
|
234
234
|
# To create a new member via domain matching, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
|
235
235
|
#
|
236
236
|
# Only Email Magic Link, OAuth, and SMS OTP factors can be transferred between sessions. Other authentication factors, such as password factors, will not be transferred to the new session.
|
237
237
|
# Any OAuth Tokens owned by the Member will not be transferred to the new Organization.
|
238
238
|
# SMS OTP factors can be used to fulfill MFA requirements for the target Organization if both the original and target Member have the same phone number and the phone number is verified for both Members.
|
239
|
+
# HubSpot and Slack OAuth registrations will not be transferred between sessions. Instead, you will receive a corresponding factor with type `"oauth_exchange_slack"` or `"oauth_exchange_hubspot"`
|
239
240
|
#
|
240
241
|
# 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.
|
241
242
|
# 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.
|
@@ -271,7 +272,7 @@ module StytchB2B
|
|
271
272
|
# Total custom claims size cannot exceed four kilobytes.
|
272
273
|
# The type of this field is nilable +object+.
|
273
274
|
# locale::
|
274
|
-
# If the
|
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
276
|
#
|
276
277
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
277
278
|
#
|
@@ -340,7 +341,7 @@ module StytchB2B
|
|
340
341
|
post_request('/v1/b2b/sessions/exchange', request, headers)
|
341
342
|
end
|
342
343
|
|
343
|
-
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing
|
344
|
+
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. 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. You will need to create the member before using this endpoint.
|
344
345
|
#
|
345
346
|
# == Parameters:
|
346
347
|
# session_token::
|
data/lib/stytch/b2b_sso.rb
CHANGED
@@ -136,7 +136,7 @@ module StytchB2B
|
|
136
136
|
# If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
|
137
137
|
# To link this authentication event to an existing Stytch session, include either the `session_token` or `session_jwt` param.
|
138
138
|
#
|
139
|
-
# If the
|
139
|
+
# 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
140
|
# 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),
|
141
141
|
# 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.
|
142
142
|
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
@@ -175,7 +175,7 @@ module StytchB2B
|
|
175
175
|
# Total custom claims size cannot exceed four kilobytes.
|
176
176
|
# The type of this field is nilable +object+.
|
177
177
|
# locale::
|
178
|
-
# If the
|
178
|
+
# 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
179
|
#
|
180
180
|
# Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
181
181
|
#
|
@@ -395,6 +395,12 @@ module StytchB2B
|
|
395
395
|
# identity_provider::
|
396
396
|
# The identity provider of this connection. For OIDC, the accepted values are `generic`, `okta`, and `microsoft-entra`. For SAML, the accepted values are `generic`, `okta`, `microsoft-entra`, and `google-workspace`.
|
397
397
|
# The type of this field is nilable +UpdateConnectionRequestIdentityProvider+ (string enum).
|
398
|
+
# custom_scopes::
|
399
|
+
# 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.
|
400
|
+
# The type of this field is nilable +String+.
|
401
|
+
# attribute_mapping::
|
402
|
+
# An object that represents the attributes used to identify a Member. This object will map the IdP-defined User attributes to Stytch-specific values, which will appear on the member's Trusted Metadata.
|
403
|
+
# The type of this field is nilable +object+.
|
398
404
|
#
|
399
405
|
# == Returns:
|
400
406
|
# An object with the following fields:
|
@@ -425,6 +431,8 @@ module StytchB2B
|
|
425
431
|
userinfo_url: nil,
|
426
432
|
jwks_url: nil,
|
427
433
|
identity_provider: nil,
|
434
|
+
custom_scopes: nil,
|
435
|
+
attribute_mapping: nil,
|
428
436
|
method_options: nil
|
429
437
|
)
|
430
438
|
headers = {}
|
@@ -439,6 +447,8 @@ module StytchB2B
|
|
439
447
|
request[:userinfo_url] = userinfo_url unless userinfo_url.nil?
|
440
448
|
request[:jwks_url] = jwks_url unless jwks_url.nil?
|
441
449
|
request[:identity_provider] = identity_provider unless identity_provider.nil?
|
450
|
+
request[:custom_scopes] = custom_scopes unless custom_scopes.nil?
|
451
|
+
request[:attribute_mapping] = attribute_mapping unless attribute_mapping.nil?
|
442
452
|
|
443
453
|
put_request("/v1/b2b/sso/oidc/#{organization_id}/connections/#{connection_id}", request, headers)
|
444
454
|
end
|
@@ -611,7 +621,7 @@ module StytchB2B
|
|
611
621
|
# `attribute_mapping`. Make sure that your IdP is configured to correctly send the group information.
|
612
622
|
# The type of this field is nilable list of +SAMLGroupImplicitRoleAssignment+.
|
613
623
|
# alternative_audience_uri::
|
614
|
-
# 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.
|
624
|
+
# 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.
|
615
625
|
# The type of this field is nilable +String+.
|
616
626
|
# identity_provider::
|
617
627
|
# The identity provider of this connection. For OIDC, the accepted values are `generic`, `okta`, and `microsoft-entra`. For SAML, the accepted values are `generic`, `okta`, `microsoft-entra`, and `google-workspace`.
|
data/lib/stytch/b2b_totps.rb
CHANGED
@@ -16,7 +16,7 @@ module StytchB2B
|
|
16
16
|
@connection = connection
|
17
17
|
end
|
18
18
|
|
19
|
-
# Create a new TOTP instance for a
|
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.
|
20
20
|
#
|
21
21
|
# Passing an intermediate session token, session token, or session JWT is not required, but if passed must match the Member ID passed.
|
22
22
|
#
|
@@ -196,7 +196,7 @@ module StytchB2B
|
|
196
196
|
post_request('/v1/b2b/totp/authenticate', request, headers)
|
197
197
|
end
|
198
198
|
|
199
|
-
# Migrate an existing TOTP instance for a
|
199
|
+
# Migrate an existing TOTP instance for a. Recovery codes are not required and will be minted for the Member if not provided.
|
200
200
|
#
|
201
201
|
# == Parameters:
|
202
202
|
# organization_id::
|
data/lib/stytch/version.rb
CHANGED
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|