stytch 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 734345852cfe96eb50bcbb218b9757310c0f324b1326b96488cff983d4b4cc29
4
- data.tar.gz: 62be1b92820bf7ef7cba5a0956bcdab696e13aee6f69acb0f68de9ae17f7b134
3
+ metadata.gz: f191b11ecf499de4ea27a1eff18ada545ecfa999e46e18c9170d010161c0a08c
4
+ data.tar.gz: 142be9df24b3b26f388407db08647f618d9910db51e25ca88fe11e35cfd28a18
5
5
  SHA512:
6
- metadata.gz: 58db37330e6d76f2d95747a678f5de69ce5e831b2e293bf5e316fc5afb130a303399fdf3d64fb2e2ee1efc4f3c219712b9e06a3c3b34ffda7549ebdbac9fedf3
7
- data.tar.gz: 4cf8c4f8201e6717594a64d68584fd073f18b52674df440c1f53add007ac1a0f8f7867c99b5889984a587fff291ab75231fb5b470037b08ab9600a46307118e8
6
+ metadata.gz: a85ad3a934eb36560641c7b37017bf0d3ff981a2df27d18440d8a714a52c9e1b5c6f16f2b4a8f9f261e51c5f1afd7e53175f8f39de18a6ae2bc354faa56e14a8
7
+ data.tar.gz: aca18f76d5c72ae175ef53d92a2ad833cf078934e8ebf49fc3eac96cfb00e66db4295a7569809a294beef8220ba4e895f64edc17577213c283d2029c52036e32
@@ -0,0 +1,29 @@
1
+ name: Check links in README.md
2
+
3
+ on:
4
+ schedule:
5
+ # Every 4 hours at X:00
6
+ - cron: "0 */4 * * *"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ check-links:
11
+ runs-on: ubuntu-latest
12
+ name: Check links in README.md
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+
16
+ - name: Get links
17
+ run: |
18
+ grep -Eo "\[[^][]+]\((https?://stytch.com[^()]+)\)" README.md | grep -Eo "https:[^)]*" | sort -u > links.txt
19
+ found_bad=0
20
+ for link in $(cat links.txt); do
21
+ status_code=$(curl -s -o /dev/null -w "%{http_code}" $link)
22
+ if [[ "$status_code" != "200" ]]; then
23
+ echo "$link -> $status_code"
24
+ found_bad=1
25
+ fi
26
+ done
27
+ if [[ $found_bad == 1 ]]; then
28
+ exit 1
29
+ fi
data/README.md CHANGED
@@ -24,18 +24,18 @@ Or install it yourself as:
24
24
 
25
25
  You can find your API credentials in the [Stytch Dashboard](https://stytch.com/dashboard/api-keys).
26
26
 
27
- This client library supports all of Stytch's live products:
27
+ This client library supports all Stytch's live products:
28
28
  - [x] [Email Magic Links](https://stytch.com/docs/api/send-by-email)
29
- - [x] [Embeddable Magic Links](https://stytch.com/docs/api/create-magic-link-overview)
30
- - [x] [OAuth logins](https://stytch.com/docs/api/oauth-overview)
29
+ - [x] [Embeddable Magic Links](https://stytch.com/docs/guides/magic-links/embeddable-magic-links/api)
30
+ - [x] [OAuth logins](https://stytch.com/docs/guides/oauth/idp-overview)
31
31
  - [x] [SMS passcodes](https://stytch.com/docs/api/send-otp-by-sms)
32
32
  - [x] [WhatsApp passcodes](https://stytch.com/docs/api/whatsapp-send)
33
33
  - [x] [Email passcodes](https://stytch.com/docs/api/send-otp-by-email)
34
- - [x] [Session Management](https://stytch.com/docs/api/sessions-overview)
35
- - [x] [WebAuthn](https://stytch.com/docs/api/webauthn-overview)
36
- - [x] [Time-based one-time passcodes (TOTPs)](https://stytch.com/docs/api/totps-overview)
37
- - [x] [Crypto wallets](https://stytch.com/docs/api/crypto-wallet-overview)
38
- - [x] [Passwords (Beta)](https://stytch.com/docs/api/password-overview)
34
+ - [x] [Session Management](https://stytch.com/docs/guides/sessions/using-sessions)
35
+ - [x] [WebAuthn](https://stytch.com/docs/guides/webauthn/api)
36
+ - [x] [Time-based one-time passcodes (TOTPs)](https://stytch.com/docs/guides/totp/api)
37
+ - [x] [Crypto wallets](https://stytch.com/docs/guides/web3/api)
38
+ - [x] [Passwords](https://stytch.com/docs/guides/passwords/api)
39
39
 
40
40
  ### Example usage
41
41
  Create an API client:
@@ -79,7 +79,7 @@ If you've found a bug, [open an issue](https://github.com/stytchauth/stytch-ruby
79
79
 
80
80
  If you have questions or want help troubleshooting, join us in [Slack](https://join.slack.com/t/stytch/shared_invite/zt-nil4wo92-jApJ9Cl32cJbEd9esKkvyg) or email support@stytch.com.
81
81
 
82
- If you've found a security vulnerability, please follow our [responsible disclosure instructions](https://stytch.com/docs/security).
82
+ If you've found a security vulnerability, please follow our [responsible disclosure instructions](https://stytch.com/docs/resources/security-and-trust/security#:~:text=Responsible%20disclosure%20program).
83
83
 
84
84
  ## Development
85
85
 
@@ -8,12 +8,13 @@ require_relative 'b2b_otp'
8
8
  require_relative 'b2b_passwords'
9
9
  require_relative 'b2b_sessions'
10
10
  require_relative 'b2b_sso'
11
+ require_relative 'm2m'
11
12
 
12
13
  module StytchB2B
13
14
  class Client
14
15
  ENVIRONMENTS = %i[live test].freeze
15
16
 
16
- attr_reader :discovery, :magic_links, :oauth, :otps, :organizations, :passwords, :sso, :sessions
17
+ attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :sso, :sessions
17
18
 
18
19
  def initialize(project_id:, secret:, env: nil, &block)
19
20
  @api_host = api_host(env, project_id)
@@ -23,6 +24,7 @@ module StytchB2B
23
24
  create_connection(&block)
24
25
 
25
26
  @discovery = StytchB2B::Discovery.new(@connection)
27
+ @m2m = Stytch::M2M.new(@connection, project_id)
26
28
  @magic_links = StytchB2B::MagicLinks.new(@connection)
27
29
  @oauth = StytchB2B::OAuth.new(@connection)
28
30
  @otps = StytchB2B::OTPs.new(@connection)
@@ -32,9 +32,18 @@ module StytchB2B
32
32
  #
33
33
  # This endpoint can be used to accept invites and create new members via domain matching.
34
34
  #
35
+ # (Coming Soon) If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`.
36
+ # The `intermediate_session_token` will not be consumed and instead will be returned in the response.
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
+ # 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
+ # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
40
+ #
35
41
  # == Parameters:
36
42
  # intermediate_session_token::
37
- # The Intermediate Session Token. This token does not belong to a specific instance of a member, but may be exchanged for an existing Member Session or used to create a new organization.
43
+ # 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.
44
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete an MFA flow;
45
+ # 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;
46
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
38
47
  # The type of this field is +String+.
39
48
  # organization_id::
40
49
  # 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.
@@ -58,7 +67,14 @@ module StytchB2B
58
67
  # Total custom claims size cannot exceed four kilobytes.
59
68
  # The type of this field is nilable +object+.
60
69
  # locale::
61
- # (no documentation yet)
70
+ # (Coming Soon) If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
71
+ #
72
+ # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
73
+ #
74
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
75
+ #
76
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
77
+ #
62
78
  # The type of this field is nilable +ExchangeRequestLocale+ (string enum).
63
79
  #
64
80
  # == Returns:
@@ -81,12 +97,24 @@ module StytchB2B
81
97
  # organization::
82
98
  # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
83
99
  # The type of this field is +Organization+ (+object+).
100
+ # member_authenticated::
101
+ # Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
102
+ # The type of this field is +Boolean+.
103
+ # intermediate_session_token::
104
+ # The returned Intermediate Session Token is identical to the one that was originally passed in to the request.
105
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA flow and log in to the Organization.
106
+ # It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a different existing Organization,
107
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization.
108
+ # The type of this field is +String+.
84
109
  # status_code::
85
110
  # 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.
86
111
  # The type of this field is +Integer+.
87
112
  # member_session::
88
113
  # The [Session object](https://stytch.com/docs/b2b/api/session-object).
89
114
  # The type of this field is nilable +MemberSession+ (+object+).
115
+ # mfa_required::
116
+ # (Coming Soon) Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
117
+ # The type of this field is nilable +MfaRequired+ (+object+).
90
118
  def exchange(
91
119
  intermediate_session_token:,
92
120
  organization_id:,
@@ -120,9 +148,18 @@ module StytchB2B
120
148
  #
121
149
  # This endpoint can also be used to start an initial session for the newly created member and organization.
122
150
  #
151
+ # (Coming Soon) 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.
152
+ # The `intermediate_session_token` will not be consumed and instead will be returned in the response.
153
+ # 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.
154
+ # 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.
155
+ # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
156
+ #
123
157
  # == Parameters:
124
158
  # intermediate_session_token::
125
- # The Intermediate Session Token. This token does not belong to a specific instance of a member, but may be exchanged for an existing Member Session or used to create a new organization.
159
+ # 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.
160
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete an MFA flow;
161
+ # 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;
162
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
126
163
  # The type of this field is +String+.
127
164
  # organization_name::
128
165
  # 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.
@@ -203,7 +240,12 @@ module StytchB2B
203
240
  #
204
241
  # The type of this field is nilable list of +String+.
205
242
  # mfa_policy::
206
- # (no documentation yet)
243
+ # (Coming Soon) The setting that controls the MFA policy for all Members in the Organization. The accepted values are:
244
+ #
245
+ # `REQUIRED_FOR_ALL` – All Members within the Organization will be required to complete MFA every time they wish to log in.
246
+ #
247
+ # `OPTIONAL` – The default value. The Organization does not require MFA by default for all Members. Members will be required to complete MFA only if their `mfa_enrolled` status is set to true.
248
+ #
207
249
  # The type of this field is nilable +String+.
208
250
  #
209
251
  # == Returns:
@@ -223,6 +265,15 @@ module StytchB2B
223
265
  # member::
224
266
  # The [Member object](https://stytch.com/docs/b2b/api/member-object).
225
267
  # The type of this field is +Member+ (+object+).
268
+ # member_authenticated::
269
+ # Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
270
+ # The type of this field is +Boolean+.
271
+ # intermediate_session_token::
272
+ # The returned Intermediate Session Token is identical to the one that was originally passed in to the request.
273
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA flow and log in to the Organization.
274
+ # It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a different existing Organization,
275
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization.
276
+ # The type of this field is +String+.
226
277
  # status_code::
227
278
  # 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.
228
279
  # The type of this field is +Integer+.
@@ -232,6 +283,9 @@ module StytchB2B
232
283
  # organization::
233
284
  # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
234
285
  # The type of this field is nilable +Organization+ (+object+).
286
+ # mfa_required::
287
+ # (Coming Soon) Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
288
+ # The type of this field is nilable +MfaRequired+ (+object+).
235
289
  def create(
236
290
  intermediate_session_token:,
237
291
  organization_name:,
@@ -284,7 +338,10 @@ module StytchB2B
284
338
  #
285
339
  # == Parameters:
286
340
  # intermediate_session_token::
287
- # The Intermediate Session Token. This token does not belong to a specific instance of a member, but may be exchanged for an existing Member Session or used to create a new organization.
341
+ # 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.
342
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete an MFA flow;
343
+ # 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;
344
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
288
345
  # The type of this field is nilable +String+.
289
346
  # session_token::
290
347
  # A secret token for a given Stytch Session.
@@ -318,13 +375,15 @@ module StytchB2B
318
375
  # status_code::
319
376
  # 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.
320
377
  # The type of this field is +Integer+.
378
+ # organization_id_hint::
379
+ # If the intermediate session token is associated with a specific Organization, that Organization ID will be returned here. The Organization ID will be null if the intermediate session token was generated by a email magic link discovery or OAuth discovery flow. If a session token or session JWT is provided, the Organization ID hint will be null.
380
+ # The type of this field is nilable +String+.
321
381
  def list(
322
382
  intermediate_session_token: nil,
323
383
  session_token: nil,
324
384
  session_jwt: nil
325
385
  )
326
- request = {
327
- }
386
+ request = {}
328
387
  request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?
329
388
  request[:session_token] = session_token unless session_token.nil?
330
389
  request[:session_jwt] = session_jwt unless session_jwt.nil?
@@ -20,7 +20,15 @@ module StytchB2B
20
20
  @discovery = StytchB2B::MagicLinks::Discovery.new(@connection)
21
21
  end
22
22
 
23
- # Authenticate a Member with a Magic Link. This endpoint requires a Magic Link token that is not expired or previously used. If the Member’s status is `pending` or `invited`, they will be updated to `active`. 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
+ # Authenticate a Member with a Magic Link. This endpoint requires a Magic Link token that is not expired or previously used. If the Member’s status is `pending` or `invited`, they will be updated to `active`.
24
+ # 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
+ #
26
+ # (Coming Soon) If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
27
+ # 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.
28
+ # 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.
29
+ # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
30
+ #
31
+ # If a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step.
24
32
  #
25
33
  # == Parameters:
26
34
  # magic_links_token::
@@ -58,7 +66,14 @@ module StytchB2B
58
66
  # Total custom claims size cannot exceed four kilobytes.
59
67
  # The type of this field is nilable +object+.
60
68
  # locale::
61
- # (no documentation yet)
69
+ # (Coming Soon) If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
70
+ #
71
+ # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
72
+ #
73
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
74
+ #
75
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
76
+ #
62
77
  # The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
63
78
  #
64
79
  # == Returns:
@@ -94,9 +109,21 @@ module StytchB2B
94
109
  # organization::
95
110
  # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
96
111
  # The type of this field is +Organization+ (+object+).
112
+ # intermediate_session_token::
113
+ # The returned Intermediate Session Token contains an Email Magic Link factor associated with the Member's email address.
114
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA flow and log in to the Organization.
115
+ # It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a different existing Organization that allows login with Email Magic Links,
116
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization.
117
+ # The type of this field is +String+.
118
+ # member_authenticated::
119
+ # Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
120
+ # The type of this field is +Boolean+.
97
121
  # status_code::
98
122
  # 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.
99
123
  # The type of this field is +Integer+.
124
+ # mfa_required::
125
+ # (Coming Soon) Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
126
+ # The type of this field is nilable +MfaRequired+ (+object+).
100
127
  def authenticate(
101
128
  magic_links_token:,
102
129
  pkce_code_verifier: nil,
@@ -381,7 +408,10 @@ module StytchB2B
381
408
  # 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.
382
409
  # The type of this field is +String+.
383
410
  # intermediate_session_token::
384
- # The Intermediate Session Token. This token does not belong to a specific instance of a member, but may be exchanged for an existing Member Session or used to create a new organization.
411
+ # 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.
412
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete an MFA flow;
413
+ # 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;
414
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
385
415
  # The type of this field is +String+.
386
416
  # email_address::
387
417
  # The email address.
@@ -21,6 +21,13 @@ module StytchB2B
21
21
 
22
22
  # Authenticate a Member given a `token`. This endpoint verifies that the member completed the OAuth flow by verifying that the token is valid and hasn't expired. Provide the `session_duration_minutes` parameter to set the lifetime of the session. If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
23
23
  #
24
+ # (Coming Soon) If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
25
+ # 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
+ # 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
+ # The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
28
+ #
29
+ # If a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step.
30
+ #
24
31
  # == Parameters:
25
32
  # oauth_token::
26
33
  # The token to authenticate.
@@ -53,7 +60,14 @@ module StytchB2B
53
60
  # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
54
61
  # The type of this field is nilable +String+.
55
62
  # locale::
56
- # (no documentation yet)
63
+ # (Coming Soon) If the Member needs to complete an MFA step, and the Member has a phone number, this endpoint will pre-emptively send a one-time passcode (OTP) to the Member's phone number. The locale argument will be used to determine which language to use when sending the passcode.
64
+ #
65
+ # Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
66
+ #
67
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
68
+ #
69
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
70
+ #
57
71
  # The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
58
72
  #
59
73
  # == Returns:
@@ -65,10 +79,10 @@ module StytchB2B
65
79
  # Globally unique UUID that identifies a specific Member.
66
80
  # The type of this field is +String+.
67
81
  # provider_subject::
68
- # (no documentation yet)
82
+ # The unique identifier for the User within a given OAuth provider. Also commonly called the `sub` or "Subject field" in OAuth protocols.
69
83
  # The type of this field is +String+.
70
84
  # provider_type::
71
- # (no documentation yet)
85
+ # Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
72
86
  # The type of this field is +String+.
73
87
  # session_token::
74
88
  # A secret token for a given Stytch Session.
@@ -88,6 +102,15 @@ module StytchB2B
88
102
  # reset_sessions::
89
103
  # (no documentation yet)
90
104
  # The type of this field is +Boolean+.
105
+ # member_authenticated::
106
+ # Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
107
+ # The type of this field is +Boolean+.
108
+ # intermediate_session_token::
109
+ # The returned Intermediate Session Token contains an OAuth factor associated with the Member's email address.
110
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA flow and log in to the Organization.
111
+ # It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a different existing Organization that allows login with OAuth,
112
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization.
113
+ # The type of this field is +String+.
91
114
  # status_code::
92
115
  # 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.
93
116
  # The type of this field is +Integer+.
@@ -99,6 +122,9 @@ module StytchB2B
99
122
  #
100
123
  # Note that these values will vary based on the OAuth provider in question, e.g. `id_token` is only returned by Microsoft.
101
124
  # The type of this field is nilable +ProviderValues+ (+object+).
125
+ # mfa_required::
126
+ # (Coming Soon) Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
127
+ # The type of this field is nilable +MfaRequired+ (+object+).
102
128
  def authenticate(
103
129
  oauth_token:,
104
130
  session_token: nil,
@@ -156,7 +182,10 @@ module StytchB2B
156
182
  # 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.
157
183
  # The type of this field is +String+.
158
184
  # intermediate_session_token::
159
- # The Intermediate Session Token. This token does not belong to a specific instance of a member, but may be exchanged for an existing Member Session or used to create a new organization.
185
+ # 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.
186
+ # The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete an MFA flow;
187
+ # 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;
188
+ # or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
160
189
  # The type of this field is +String+.
161
190
  # email_address::
162
191
  # The email address.
@@ -21,7 +21,7 @@ module StytchB2B
21
21
 
22
22
  # Creates an Organization. An `organization_name` and a unique `organization_slug` are required.
23
23
  #
24
- # By default, `email_invites` and `sso_jit_provisioning` will be set to `ALL_ALLOWED` if no Organization authentication settings are explicitly defined in the request.
24
+ # 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.
25
25
  #
26
26
  # *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.
27
27
  #
@@ -87,7 +87,12 @@ module StytchB2B
87
87
  #
88
88
  # The type of this field is nilable list of +String+.
89
89
  # mfa_policy::
90
- # (no documentation yet)
90
+ # (Coming Soon) The setting that controls the MFA policy for all Members in the Organization. The accepted values are:
91
+ #
92
+ # `REQUIRED_FOR_ALL` – All Members within the Organization will be required to complete MFA every time they wish to log in.
93
+ #
94
+ # `OPTIONAL` – The default value. The Organization does not require MFA by default for all Members. Members will be required to complete MFA only if their `mfa_enrolled` status is set to true.
95
+ #
91
96
  # The type of this field is nilable +String+.
92
97
  #
93
98
  # == Returns:
@@ -152,8 +157,7 @@ module StytchB2B
152
157
  def get(
153
158
  organization_id:
154
159
  )
155
- query_params = {
156
- }
160
+ query_params = {}
157
161
  request = request_with_query_params("/v1/b2b/organizations/#{organization_id}", query_params)
158
162
  get_request(request)
159
163
  end
@@ -234,7 +238,12 @@ module StytchB2B
234
238
  #
235
239
  # The type of this field is nilable list of +String+.
236
240
  # mfa_policy::
237
- # (no documentation yet)
241
+ # (Coming Soon) The setting that controls the MFA policy for all Members in the Organization. The accepted values are:
242
+ #
243
+ # `REQUIRED_FOR_ALL` – All Members within the Organization will be required to complete MFA every time they wish to log in.
244
+ #
245
+ # `OPTIONAL` – The default value. The Organization does not require MFA by default for all Members. Members will be required to complete MFA only if their `mfa_enrolled` status is set to true.
246
+ #
238
247
  # The type of this field is nilable +String+.
239
248
  #
240
249
  # == Returns:
@@ -264,8 +273,7 @@ module StytchB2B
264
273
  allowed_auth_methods: nil,
265
274
  mfa_policy: nil
266
275
  )
267
- request = {
268
- }
276
+ request = {}
269
277
  request[:organization_name] = organization_name unless organization_name.nil?
270
278
  request[:organization_slug] = organization_slug unless organization_slug.nil?
271
279
  request[:organization_logo_url] = organization_logo_url unless organization_logo_url.nil?
@@ -342,8 +350,7 @@ module StytchB2B
342
350
  limit: nil,
343
351
  query: nil
344
352
  )
345
- request = {
346
- }
353
+ request = {}
347
354
  request[:cursor] = cursor unless cursor.nil?
348
355
  request[:limit] = limit unless limit.nil?
349
356
  request[:query] = query unless query.nil?
@@ -381,11 +388,11 @@ module StytchB2B
381
388
  # is_breakglass::
382
389
  # Identifies the Member as a break glass user - someone who has permissions to authenticate into an Organization by bypassing the Organization's settings. A break glass account is typically used for emergency purposes to gain access outside of normal authentication procedures. Refer to the [Organization object](organization-object) and its `auth_methods` and `allowed_auth_methods` fields for more details.
383
390
  # The type of this field is nilable +Boolean+.
384
- # phone_number::
391
+ # mfa_phone_number::
385
392
  # (no documentation yet)
386
393
  # The type of this field is nilable +String+.
387
394
  # mfa_enrolled::
388
- # (no documentation yet)
395
+ # (Coming Soon) Sets whether the Member is enrolled in MFA. If true, the Member must complete an MFA step whenever they wish to log in to their Organization. If false, the Member only needs to complete an MFA step if the Organization's MFA policy is set to `REQUIRED_FOR_ALL`.
389
396
  # The type of this field is nilable +Boolean+.
390
397
  #
391
398
  # == Returns:
@@ -412,16 +419,15 @@ module StytchB2B
412
419
  trusted_metadata: nil,
413
420
  untrusted_metadata: nil,
414
421
  is_breakglass: nil,
415
- phone_number: nil,
422
+ mfa_phone_number: nil,
416
423
  mfa_enrolled: nil
417
424
  )
418
- request = {
419
- }
425
+ request = {}
420
426
  request[:name] = name unless name.nil?
421
427
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
422
428
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
423
429
  request[:is_breakglass] = is_breakglass unless is_breakglass.nil?
424
- request[:phone_number] = phone_number unless phone_number.nil?
430
+ request[:mfa_phone_number] = mfa_phone_number unless mfa_phone_number.nil?
425
431
  request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
426
432
 
427
433
  put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request)
@@ -455,11 +461,11 @@ module StytchB2B
455
461
  delete_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}")
456
462
  end
457
463
 
458
- def delete_phone_number(
464
+ def delete_mfa_phone_number(
459
465
  organization_id:,
460
466
  member_id:
461
467
  )
462
- delete_request("/v1/b2b/organizations/#{organization_id}/members/phone_numbers/#{member_id}")
468
+ delete_request("/v1/b2b/organizations/#{organization_id}/members/mfa_phone_numbers/#{member_id}")
463
469
  end
464
470
 
465
471
  # Search for Members within specified Organizations. An array with at least one `organization_id` is required. Submitting an empty `query` returns all Members within the specified Organizations.
@@ -477,7 +483,7 @@ module StytchB2B
477
483
  # The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the `cursor` field.
478
484
  # The type of this field is nilable +Integer+.
479
485
  # query::
480
- # The optional query object contains the operator, i.e. `AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all Organizations with no filtering applied.
486
+ # The optional query object contains the operator, i.e. `AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all Members with no filtering applied.
481
487
  # The type of this field is nilable +SearchQuery+ (+object+).
482
488
  #
483
489
  # == Returns:
@@ -573,11 +579,11 @@ module StytchB2B
573
579
  # is_breakglass::
574
580
  # Identifies the Member as a break glass user - someone who has permissions to authenticate into an Organization by bypassing the Organization's settings. A break glass account is typically used for emergency purposes to gain access outside of normal authentication procedures. Refer to the [Organization object](organization-object) and its `auth_methods` and `allowed_auth_methods` fields for more details.
575
581
  # The type of this field is nilable +Boolean+.
576
- # phone_number::
582
+ # mfa_phone_number::
577
583
  # (no documentation yet)
578
584
  # The type of this field is nilable +String+.
579
585
  # mfa_enrolled::
580
- # (no documentation yet)
586
+ # (Coming Soon) Sets whether the Member is enrolled in MFA. If true, the Member must complete an MFA step whenever they wish to log in to their Organization. If false, the Member only needs to complete an MFA step if the Organization's MFA policy is set to `REQUIRED_FOR_ALL`.
581
587
  # The type of this field is nilable +Boolean+.
582
588
  #
583
589
  # == Returns:
@@ -605,7 +611,7 @@ module StytchB2B
605
611
  untrusted_metadata: nil,
606
612
  create_member_as_pending: nil,
607
613
  is_breakglass: nil,
608
- phone_number: nil,
614
+ mfa_phone_number: nil,
609
615
  mfa_enrolled: nil
610
616
  )
611
617
  request = {
@@ -616,7 +622,7 @@ module StytchB2B
616
622
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
617
623
  request[:create_member_as_pending] = create_member_as_pending unless create_member_as_pending.nil?
618
624
  request[:is_breakglass] = is_breakglass unless is_breakglass.nil?
619
- request[:phone_number] = phone_number unless phone_number.nil?
625
+ request[:mfa_phone_number] = mfa_phone_number unless mfa_phone_number.nil?
620
626
  request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
621
627
 
622
628
  post_request("/v1/b2b/organizations/#{organization_id}/members", request)