stytch 9.9.0 → 9.11.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 +11 -11
- data/lib/stytch/b2b_otp.rb +304 -1
- data/lib/stytch/b2b_sso.rb +12 -4
- data/lib/stytch/otps.rb +2 -2
- data/lib/stytch/users.rb +9 -1
- 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: 5c0d28f978709f9fd734d22ec07b9ead2cff5784bf2236e6f7a814ac6112bd4f
|
4
|
+
data.tar.gz: 99d3ef7c666a37a4bdb62717e4f95f10d5e62a5b4acdd30b53b1bc3b8bcc2fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a313477adea0a21456f16ab46658d2cd2a218414a4b36bea7078be9c35b7c703bbab26b3453906ec0e0f3cf718230c002c92335bf43174a82018dd4125a0173
|
7
|
+
data.tar.gz: 016de94dc4b6eefac4f061e03f6269088fb5e5936a2fcf43085f96ee278e0859a190a81e8ccee361da8925862509fc9d3f84e5ab46b03fc030a997ae428a8e39
|
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+.
|
@@ -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_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
|
@@ -237,5 +238,307 @@ module StytchB2B
|
|
237
238
|
post_request('/v1/b2b/otps/sms/authenticate', request, headers)
|
238
239
|
end
|
239
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
|
240
543
|
end
|
241
544
|
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:
|
@@ -624,7 +630,9 @@ module StytchB2B
|
|
624
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.
|
625
631
|
# The type of this field is nilable +String+.
|
626
632
|
# identity_provider::
|
627
|
-
#
|
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.
|
628
636
|
# The type of this field is nilable +UpdateConnectionRequestIdentityProvider+ (string enum).
|
629
637
|
#
|
630
638
|
# == Returns:
|
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
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.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-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|