stytch 10.27.0 → 10.29.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: 49aa54d3b047309a521fa267920e138f8eb27e8c299f5228c4c8bc565f821ce6
4
- data.tar.gz: 716a18a6bcdc9ce4288287678e204d47ae90a89a7f432e43234afa2744419e04
3
+ metadata.gz: 9837d4362966d389505ea7b235379cb635e2dc5eda22537dac31e8ec0f6e1bcd
4
+ data.tar.gz: 72ba0b2c7af66364d677ed6ae70ed3278a0375e40e6a4f00dbbe912d31407cdf
5
5
  SHA512:
6
- metadata.gz: 07cfbe4bbf895019aefd6be0d2fef3376caa5cb84fadd5c1af9c26d7d2e2ffd5399e5d9d3e2704cce5af85dc3eff494ad2ff648b1783434c933223c9408eafff
7
- data.tar.gz: 55b223a9d0deabcc07810029395f1bd117c7df2b55db9b3e814e0dc8ce68e48737b2855b65888bb0f4039b14b90849acba473f3ab3961da61272e85198542c74
6
+ metadata.gz: 3e359e41dc088a10f7174b2f72df1c3f552a82e92df50b5dd5c7b7e6cb7f6e053e3fc6a3b42f518ca66bd663d930957ece13c53b3a3ff4ddbaef788edad5ce5b
7
+ data.tar.gz: ea6fb4ed455954c907ed1d8d34cdb09057de8485037b3474b16ecdab6edfc50241737805a879a22d15c6ecbe9d63ad69532483e88605b1b58d378d0d8f201ad2
@@ -30,7 +30,7 @@ module StytchB2B
30
30
  class Client
31
31
  ENVIRONMENTS = %i[live test].freeze
32
32
 
33
- attr_reader :connected_app, :discovery, :fraud, :impersonation, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps, :idp
33
+ attr_reader :connected_app, :discovery, :fraud, :idp, :impersonation, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
34
34
 
35
35
  def initialize(project_id:, secret:, env: nil, fraud_env: nil, &block)
36
36
  @api_host = api_host(env, project_id)
@@ -43,11 +43,11 @@ module StytchB2B
43
43
 
44
44
  rbac = StytchB2B::RBAC.new(@connection)
45
45
  @policy_cache = Stytch::PolicyCache.new(rbac_client: rbac)
46
- @idp = StytchB2B::IDP.new(@connection, @project_id, @policy_cache)
47
46
 
48
47
  @connected_app = Stytch::ConnectedApp.new(@connection)
49
48
  @discovery = StytchB2B::Discovery.new(@connection)
50
49
  @fraud = Stytch::Fraud.new(@fraud_connection)
50
+ @idp = StytchB2B::IDP.new(@connection, @project_id, @policy_cache)
51
51
  @impersonation = StytchB2B::Impersonation.new(@connection)
52
52
  @m2m = Stytch::M2M.new(@connection, @project_id, @is_b2b_client)
53
53
  @magic_links = StytchB2B::MagicLinks.new(@connection)
@@ -78,6 +78,9 @@ module StytchB2B
78
78
  # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
79
79
  #
80
80
  # The type of this field is nilable +ExchangeRequestLocale+ (string enum).
81
+ # telemetry_id::
82
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
83
+ # The type of this field is nilable +String+.
81
84
  #
82
85
  # == Returns:
83
86
  # An object with the following fields:
@@ -117,12 +120,16 @@ module StytchB2B
117
120
  # primary_required::
118
121
  # Information about the primary authentication requirements of the Organization.
119
122
  # The type of this field is nilable +PrimaryRequired+ (+object+).
123
+ # member_device::
124
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
125
+ # The type of this field is nilable +DeviceInfo+ (+object+).
120
126
  def exchange(
121
127
  intermediate_session_token:,
122
128
  organization_id:,
123
129
  session_duration_minutes: nil,
124
130
  session_custom_claims: nil,
125
- locale: nil
131
+ locale: nil,
132
+ telemetry_id: nil
126
133
  )
127
134
  headers = {}
128
135
  request = {
@@ -132,6 +139,7 @@ module StytchB2B
132
139
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
133
140
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
134
141
  request[:locale] = locale unless locale.nil?
142
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
135
143
 
136
144
  post_request('/v1/b2b/discovery/intermediate_sessions/exchange', request, headers)
137
145
  end
@@ -305,6 +313,9 @@ module StytchB2B
305
313
  # allowed_third_party_connected_apps::
306
314
  # An array of third party Connected App IDs that are allowed for the Organization. Only used when the Organization's `third_party_connected_apps_allowed_type` is `RESTRICTED`.
307
315
  # The type of this field is nilable list of +String+.
316
+ # telemetry_id::
317
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
318
+ # The type of this field is nilable +String+.
308
319
  #
309
320
  # == Returns:
310
321
  # An object with the following fields:
@@ -344,6 +355,9 @@ module StytchB2B
344
355
  # primary_required::
345
356
  # Information about the primary authentication requirements of the Organization.
346
357
  # The type of this field is nilable +PrimaryRequired+ (+object+).
358
+ # member_device::
359
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
360
+ # The type of this field is nilable +DeviceInfo+ (+object+).
347
361
  def create(
348
362
  intermediate_session_token:,
349
363
  session_duration_minutes: nil,
@@ -367,7 +381,8 @@ module StytchB2B
367
381
  first_party_connected_apps_allowed_type: nil,
368
382
  allowed_first_party_connected_apps: nil,
369
383
  third_party_connected_apps_allowed_type: nil,
370
- allowed_third_party_connected_apps: nil
384
+ allowed_third_party_connected_apps: nil,
385
+ telemetry_id: nil
371
386
  )
372
387
  headers = {}
373
388
  request = {
@@ -395,6 +410,7 @@ module StytchB2B
395
410
  request[:allowed_first_party_connected_apps] = allowed_first_party_connected_apps unless allowed_first_party_connected_apps.nil?
396
411
  request[:third_party_connected_apps_allowed_type] = third_party_connected_apps_allowed_type unless third_party_connected_apps_allowed_type.nil?
397
412
  request[:allowed_third_party_connected_apps] = allowed_third_party_connected_apps unless allowed_third_party_connected_apps.nil?
413
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
398
414
 
399
415
  post_request('/v1/b2b/discovery/organizations/create', request, headers)
400
416
  end
@@ -1,37 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # !!!
4
+ # WARNING: This file is autogenerated
5
+ # Only modify code within MANUAL() sections
6
+ # or your changes may be overwritten later!
7
+ # !!!
8
+
3
9
  require 'jwt'
4
10
  require 'json/jwt'
5
11
  require_relative 'errors'
6
12
  require_relative 'request_helper'
7
- require_relative 'rbac_local'
8
13
 
9
14
  module StytchB2B
10
15
  class IDP
11
16
  include Stytch::RequestHelper
17
+ attr_reader :oauth
12
18
 
13
19
  def initialize(connection, project_id, policy_cache)
14
20
  @connection = connection
15
- @project_id = project_id
21
+
22
+ @oauth = StytchB2B::IDP::OAuth.new(@connection)
16
23
  @policy_cache = policy_cache
17
- @non_custom_claim_keys = [
18
- 'aud',
19
- 'exp',
20
- 'iat',
21
- 'iss',
22
- 'jti',
23
- 'nbf',
24
- 'sub',
25
- 'active',
26
- 'client_id',
27
- 'request_id',
28
- 'scope',
29
- 'status_code',
30
- 'token_type',
31
- 'https://stytch.com/organization'
32
- ]
24
+ @project_id = project_id
25
+ @cache_last_update = 0
26
+ @jwks_loader = lambda do |options|
27
+ @cached_keys = nil if options[:invalidate] && @cache_last_update < Time.now.to_i - 300
28
+ @cached_keys ||= begin
29
+ @cache_last_update = Time.now.to_i
30
+ keys = []
31
+ get_jwks(project_id: @project_id)['keys'].each do |r|
32
+ keys << r
33
+ end
34
+ { keys: keys }
35
+ end
36
+ end
33
37
  end
34
38
 
39
+ # MANUAL(IDP::introspect_token_network)(SERVICE_METHOD)
40
+ # ADDIMPORT: require 'jwt'
41
+ # ADDIMPORT: require 'json/jwt'
42
+ # ADDIMPORT: require_relative 'errors'
43
+
35
44
  # Introspects a token JWT from an authorization code response.
36
45
  # Access tokens are JWTs signed with the project's JWKs. Refresh tokens are opaque tokens.
37
46
  # Access tokens contain a standard set of claims as well as any custom claims generated from templates.
@@ -105,7 +114,7 @@ module StytchB2B
105
114
 
106
115
  return nil unless jwt_response['active']
107
116
 
108
- custom_claims = jwt_response.reject { |k, _| @non_custom_claim_keys.include?(k) }
117
+ custom_claims = jwt_response.reject { |k, _| non_custom_claim_keys.include?(k) }
109
118
  organization_claim = jwt_response['https://stytch.com/organization']
110
119
  organization_id = organization_claim['organization_id']
111
120
  scope = jwt_response['scope']
@@ -183,17 +192,6 @@ module StytchB2B
183
192
  scope_claim = 'scope'
184
193
  organization_claim = 'https://stytch.com/organization'
185
194
 
186
- # Create a JWKS loader similar to other classes in the codebase
187
- @cache_last_update = 0
188
- jwks_loader = lambda do |options|
189
- @cached_keys = nil if options[:invalidate] && @cache_last_update < Time.now.to_i - 300
190
- if @cached_keys.nil?
191
- @cached_keys = get_jwks(project_id: @project_id)
192
- @cache_last_update = Time.now.to_i
193
- end
194
- @cached_keys
195
- end
196
-
197
195
  begin
198
196
  decoded_jwt = JWT.decode(
199
197
  access_token,
@@ -201,14 +199,14 @@ module StytchB2B
201
199
  true,
202
200
  {
203
201
  algorithms: ['RS256'],
204
- jwks: jwks_loader,
202
+ jwks: @jwks_loader,
205
203
  iss: ["stytch.com/#{@project_id}", @connection.url_prefix],
206
204
  aud: @project_id
207
205
  }
208
206
  )[0]
209
207
 
210
208
  generic_claims = decoded_jwt
211
- custom_claims = generic_claims.reject { |k, _| @non_custom_claim_keys.include?(k) }
209
+ custom_claims = generic_claims.reject { |k, _| non_custom_claim_keys.include?(k) }
212
210
  organization_claim_data = generic_claims[organization_claim]
213
211
  organization_id = organization_claim_data['organization_id']
214
212
  scope = generic_claims[scope_claim]
@@ -246,6 +244,27 @@ module StytchB2B
246
244
  end
247
245
  end
248
246
 
247
+ private
248
+
249
+ def non_custom_claim_keys
250
+ [
251
+ 'aud',
252
+ 'exp',
253
+ 'iat',
254
+ 'iss',
255
+ 'jti',
256
+ 'nbf',
257
+ 'sub',
258
+ 'active',
259
+ 'client_id',
260
+ 'request_id',
261
+ 'scope',
262
+ 'status_code',
263
+ 'token_type',
264
+ 'https://stytch.com/organization'
265
+ ]
266
+ end
267
+
249
268
  # Gets the JWKS for the project.
250
269
  #
251
270
  # == Parameters:
@@ -262,5 +281,226 @@ module StytchB2B
262
281
  request = request_with_query_params("/v1/b2b/sessions/jwks/#{project_id}", query_params)
263
282
  get_request(request, headers)
264
283
  end
284
+
285
+ # ENDMANUAL(IDP::introspect_token_network)
286
+
287
+ class OAuth
288
+ include Stytch::RequestHelper
289
+
290
+ def initialize(connection)
291
+ @connection = connection
292
+ end
293
+
294
+ # Initiates a request for authorization of a Connected App to access a Member's account.
295
+ #
296
+ # Call this endpoint using the query parameters from an OAuth Authorization request.
297
+ # This endpoint validates various fields (`scope`, `client_id`, `redirect_uri`, `prompt`, etc...) are correct and returns
298
+ # relevant information for rendering an OAuth Consent Screen.
299
+ #
300
+ # This endpoint returns:
301
+ # - A public representation of the Connected App requesting authorization
302
+ # - Whether _explicit_ consent must be granted before proceeding with the authorization
303
+ # - A list of scopes the Member has the ability to grant the Connected App
304
+ #
305
+ # Use this response to prompt the Member for consent (if necessary) before calling the [Submit OAuth Authorization](https://stytch.com/docs/b2b/api/connected-apps-oauth-authorize) endpoint.
306
+ #
307
+ # Exactly one of the following must be provided to identify the Member granting authorization:
308
+ # - `organization_id` + `member_id`
309
+ # - `session_token`
310
+ # - `session_jwt`
311
+ #
312
+ # If a `session_token` or `session_jwt` is passed, the OAuth Authorization will be linked to the Member's session for tracking purposes.
313
+ # One of these fields must be used if the Connected App intends to complete the [Exchange Access Token](https://stytch.com/docs/b2b/api/connected-app-access-token-exchange) flow.
314
+ #
315
+ # == Parameters:
316
+ # client_id::
317
+ # The ID of the Connected App client.
318
+ # The type of this field is +String+.
319
+ # redirect_uri::
320
+ # The callback URI used to redirect the user after authentication. This is the same URI provided at the start of the OAuth flow. This field is required when using the `authorization_code` grant.
321
+ # The type of this field is +String+.
322
+ # response_type::
323
+ # The OAuth 2.0 response type. For authorization code flows this value is `code`.
324
+ # The type of this field is +String+.
325
+ # scopes::
326
+ # An array of scopes requested by the client.
327
+ # The type of this field is list of +String+.
328
+ # organization_id::
329
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
330
+ # The type of this field is nilable +String+.
331
+ # member_id::
332
+ # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member.
333
+ # The type of this field is nilable +String+.
334
+ # session_token::
335
+ # A secret token for a given Stytch Session.
336
+ # The type of this field is nilable +String+.
337
+ # session_jwt::
338
+ # The JSON Web Token (JWT) for a given Stytch Session.
339
+ # The type of this field is nilable +String+.
340
+ # prompt::
341
+ # Space separated list that specifies how the Authorization Server should prompt the user for reauthentication and consent. Only `consent` is supported today.
342
+ # The type of this field is nilable +String+.
343
+ #
344
+ # == Returns:
345
+ # An object with the following fields:
346
+ # request_id::
347
+ # 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.
348
+ # The type of this field is +String+.
349
+ # member_id::
350
+ # Globally unique UUID that identifies a specific Member.
351
+ # The type of this field is +String+.
352
+ # member::
353
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object)
354
+ # The type of this field is +Member+ (+object+).
355
+ # organization::
356
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
357
+ # The type of this field is +Organization+ (+object+).
358
+ # client::
359
+ # (no documentation yet)
360
+ # The type of this field is +ConnectedAppPublic+ (+object+).
361
+ # consent_required::
362
+ # Whether the user must provide explicit consent for the authorization request.
363
+ # The type of this field is +Boolean+.
364
+ # scope_results::
365
+ # Details about each requested scope.
366
+ # The type of this field is list of +ScopeResult+ (+object+).
367
+ # status_code::
368
+ # (no documentation yet)
369
+ # The type of this field is +Integer+.
370
+ def authorize_start(
371
+ client_id:,
372
+ redirect_uri:,
373
+ response_type:,
374
+ scopes:,
375
+ organization_id: nil,
376
+ member_id: nil,
377
+ session_token: nil,
378
+ session_jwt: nil,
379
+ prompt: nil
380
+ )
381
+ headers = {}
382
+ request = {
383
+ client_id: client_id,
384
+ redirect_uri: redirect_uri,
385
+ response_type: response_type,
386
+ scopes: scopes
387
+ }
388
+ request[:organization_id] = organization_id unless organization_id.nil?
389
+ request[:member_id] = member_id unless member_id.nil?
390
+ request[:session_token] = session_token unless session_token.nil?
391
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
392
+ request[:prompt] = prompt unless prompt.nil?
393
+
394
+ post_request('/v1/b2b/idp/oauth/authorize/start', request, headers)
395
+ end
396
+
397
+ # Completes a request for authorization of a Connected App to access a Member's account.
398
+ #
399
+ # Call this endpoint using the query parameters from an OAuth Authorization request, after previously validating those parameters using the
400
+ # [Preflight Check](https://stytch.com/docs/b2b/api/connected-apps-oauth-authorize-start) API.
401
+ # Note that this endpoint takes in a few additional parameters the preflight check does not- `state`, `nonce`, and `code_challenge`.
402
+ #
403
+ # If the authorization was successful, the `redirect_uri` will contain a valid `authorization_code` embedded as a query parameter.
404
+ # If the authorization was unsuccessful, the `redirect_uri` will contain an OAuth2.1 `error_code`.
405
+ # In both cases, redirect the Member to the location for the response to be consumed by the Connected App.
406
+ #
407
+ # Exactly one of the following must be provided to identify the Member granting authorization:
408
+ # - `organization_id` + `member_id`
409
+ # - `session_token`
410
+ # - `session_jwt`
411
+ #
412
+ # If a `session_token` or `session_jwt` is passed, the OAuth Authorization will be linked to the Member's session for tracking purposes.
413
+ # One of these fields must be used if the Connected App intends to complete the [Exchange Access Token](https://stytch.com/docs/b2b/api/connected-app-access-token-exchange) flow.
414
+ #
415
+ # == Parameters:
416
+ # consent_granted::
417
+ # Indicates whether the user granted the requested scopes.
418
+ # The type of this field is +Boolean+.
419
+ # scopes::
420
+ # An array of scopes requested by the client.
421
+ # The type of this field is list of +String+.
422
+ # client_id::
423
+ # The ID of the Connected App client.
424
+ # The type of this field is +String+.
425
+ # redirect_uri::
426
+ # The callback URI used to redirect the user after authentication. This is the same URI provided at the start of the OAuth flow. This field is required when using the `authorization_code` grant.
427
+ # The type of this field is +String+.
428
+ # response_type::
429
+ # The OAuth 2.0 response type. For authorization code flows this value is `code`.
430
+ # The type of this field is +String+.
431
+ # organization_id::
432
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
433
+ # The type of this field is nilable +String+.
434
+ # member_id::
435
+ # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member.
436
+ # The type of this field is nilable +String+.
437
+ # session_token::
438
+ # A secret token for a given Stytch Session.
439
+ # The type of this field is nilable +String+.
440
+ # session_jwt::
441
+ # The JSON Web Token (JWT) for a given Stytch Session.
442
+ # The type of this field is nilable +String+.
443
+ # prompt::
444
+ # Space separated list that specifies how the Authorization Server should prompt the user for reauthentication and consent. Only `consent` is supported today.
445
+ # The type of this field is nilable +String+.
446
+ # state::
447
+ # An opaque value used to maintain state between the request and callback.
448
+ # The type of this field is nilable +String+.
449
+ # nonce::
450
+ # A string used to associate a client session with an ID token to mitigate replay attacks.
451
+ # The type of this field is nilable +String+.
452
+ # code_challenge::
453
+ # A base64url encoded challenge derived from the code verifier for PKCE flows.
454
+ # The type of this field is nilable +String+.
455
+ #
456
+ # == Returns:
457
+ # An object with the following fields:
458
+ # request_id::
459
+ # 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.
460
+ # The type of this field is +String+.
461
+ # redirect_uri::
462
+ # The callback URI used to redirect the user after authentication. This is the same URI provided at the start of the OAuth flow. This field is required when using the `authorization_code` grant.
463
+ # The type of this field is +String+.
464
+ # status_code::
465
+ # (no documentation yet)
466
+ # The type of this field is +Integer+.
467
+ # authorization_code::
468
+ # A one-time use code that can be exchanged for tokens.
469
+ # The type of this field is nilable +String+.
470
+ def authorize(
471
+ consent_granted:,
472
+ scopes:,
473
+ client_id:,
474
+ redirect_uri:,
475
+ response_type:,
476
+ organization_id: nil,
477
+ member_id: nil,
478
+ session_token: nil,
479
+ session_jwt: nil,
480
+ prompt: nil,
481
+ state: nil,
482
+ nonce: nil,
483
+ code_challenge: nil
484
+ )
485
+ headers = {}
486
+ request = {
487
+ consent_granted: consent_granted,
488
+ scopes: scopes,
489
+ client_id: client_id,
490
+ redirect_uri: redirect_uri,
491
+ response_type: response_type
492
+ }
493
+ request[:organization_id] = organization_id unless organization_id.nil?
494
+ request[:member_id] = member_id unless member_id.nil?
495
+ request[:session_token] = session_token unless session_token.nil?
496
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
497
+ request[:prompt] = prompt unless prompt.nil?
498
+ request[:state] = state unless state.nil?
499
+ request[:nonce] = nonce unless nonce.nil?
500
+ request[:code_challenge] = code_challenge unless code_challenge.nil?
501
+
502
+ post_request('/v1/b2b/idp/oauth/authorize', request, headers)
503
+ end
504
+ end
265
505
  end
266
506
  end
@@ -79,6 +79,9 @@ module StytchB2B
79
79
  # intermediate_session_token::
80
80
  # Adds this primary authentication factor to the intermediate session token. If the resulting set of factors satisfies the organization's primary authentication requirements and MFA requirements, the intermediate session token will be consumed and converted to a member session. If not, the same intermediate session token will be returned.
81
81
  # The type of this field is nilable +String+.
82
+ # telemetry_id::
83
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
84
+ # The type of this field is nilable +String+.
82
85
  #
83
86
  # == Returns:
84
87
  # An object with the following fields:
@@ -127,6 +130,9 @@ module StytchB2B
127
130
  # primary_required::
128
131
  # (no documentation yet)
129
132
  # The type of this field is nilable +PrimaryRequired+ (+object+).
133
+ # member_device::
134
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
135
+ # The type of this field is nilable +DeviceInfo+ (+object+).
130
136
  def authenticate(
131
137
  magic_links_token:,
132
138
  pkce_code_verifier: nil,
@@ -135,7 +141,8 @@ module StytchB2B
135
141
  session_duration_minutes: nil,
136
142
  session_custom_claims: nil,
137
143
  locale: nil,
138
- intermediate_session_token: nil
144
+ intermediate_session_token: nil,
145
+ telemetry_id: nil
139
146
  )
140
147
  headers = {}
141
148
  request = {
@@ -148,6 +155,7 @@ module StytchB2B
148
155
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
149
156
  request[:locale] = locale unless locale.nil?
150
157
  request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?
158
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
151
159
 
152
160
  post_request('/v1/b2b/magic_links/authenticate', request, headers)
153
161
  end
@@ -77,6 +77,9 @@ module StytchB2B
77
77
  # intermediate_session_token::
78
78
  # Adds this primary authentication factor to the intermediate session token. If the resulting set of factors satisfies the organization's primary authentication requirements and MFA requirements, the intermediate session token will be consumed and converted to a member session. If not, the same intermediate session token will be returned.
79
79
  # The type of this field is nilable +String+.
80
+ # telemetry_id::
81
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
82
+ # The type of this field is nilable +String+.
80
83
  #
81
84
  # == Returns:
82
85
  # An object with the following fields:
@@ -133,6 +136,9 @@ module StytchB2B
133
136
  # primary_required::
134
137
  # Information about the primary authentication requirements of the Organization.
135
138
  # The type of this field is nilable +PrimaryRequired+ (+object+).
139
+ # member_device::
140
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
141
+ # The type of this field is nilable +DeviceInfo+ (+object+).
136
142
  def authenticate(
137
143
  oauth_token:,
138
144
  session_token: nil,
@@ -141,7 +147,8 @@ module StytchB2B
141
147
  session_custom_claims: nil,
142
148
  pkce_code_verifier: nil,
143
149
  locale: nil,
144
- intermediate_session_token: nil
150
+ intermediate_session_token: nil,
151
+ telemetry_id: nil
145
152
  )
146
153
  headers = {}
147
154
  request = {
@@ -154,6 +161,7 @@ module StytchB2B
154
161
  request[:pkce_code_verifier] = pkce_code_verifier unless pkce_code_verifier.nil?
155
162
  request[:locale] = locale unless locale.nil?
156
163
  request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?
164
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
157
165
 
158
166
  post_request('/v1/b2b/oauth/authenticate', request, headers)
159
167
  end
@@ -607,7 +607,10 @@ module StytchB2B
607
607
  delete_request("/v1/b2b/organizations/#{organization_id}", headers)
608
608
  end
609
609
 
610
- # Search for Organizations. If you send a request with no body params, no filtering will be applied and the endpoint will return all Organizations. All fuzzy search filters require a minimum of three characters.
610
+ #
611
+ # **Warning**: This endpoint is not recommended for use in login flows. Scaling issues may occur, as search performance may vary from ~150 milliseconds to 9 seconds depending on query complexity and rate limits are set to 100 requests/second.
612
+ #
613
+ # Search across your Organizations. Returns an array of Organization objects.
611
614
  #
612
615
  # == Parameters:
613
616
  # cursor::
@@ -1027,7 +1030,7 @@ module StytchB2B
1027
1030
  # If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.settings.default-mfa-method` action on the `stytch.member` Resource. Alternatively, if the Member Session matches the Member associated with the `member_id` passed in the request, the authorization check will also allow a Member Session that has permission to perform the `update.settings.default-mfa-method` action on the `stytch.self` Resource.
1028
1031
  # The type of this field is nilable +String+.
1029
1032
  # email_address::
1030
- # Updates the Member's `email_address`, if provided.
1033
+ # Updates the Member's `email_address`, if provided. This will clear any existing passwords and require re-verification of the new email address.
1031
1034
  # If a Member's email address is changed, other Members in the same Organization cannot use the old email address, although the Member may update back to their old email address.
1032
1035
  # A Member's email address can only be useable again by other Members if the Member is deleted.
1033
1036
  #
@@ -1262,9 +1265,12 @@ module StytchB2B
1262
1265
  delete_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/totp", headers)
1263
1266
  end
1264
1267
 
1268
+ #
1269
+ # **Warning**: This endpoint is not recommended for use in login flows. Scaling issues may occur, as search performance may vary from ~150 milliseconds to 9 seconds depending on query complexity and rate limits are set to 100 requests/second.
1270
+ #
1265
1271
  # Search for Members within specified Organizations. An array with at least one `organization_id` is required. Submitting an empty `query` returns all non-deleted Members within the specified Organizations.
1266
1272
  #
1267
- # *All fuzzy search filters require a minimum of three characters.
1273
+ # All fuzzy search filters require a minimum of three characters.
1268
1274
  #
1269
1275
  # == Parameters:
1270
1276
  # organization_ids::
@@ -184,6 +184,9 @@ module StytchB2B
184
184
  # set_default_mfa::
185
185
  # (no documentation yet)
186
186
  # The type of this field is nilable +Boolean+.
187
+ # telemetry_id::
188
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
189
+ # The type of this field is nilable +String+.
187
190
  #
188
191
  # == Returns:
189
192
  # An object with the following fields:
@@ -211,6 +214,9 @@ module StytchB2B
211
214
  # member_session::
212
215
  # The [Session object](https://stytch.com/docs/b2b/api/session-object).
213
216
  # The type of this field is nilable +MemberSession+ (+object+).
217
+ # member_device::
218
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
219
+ # The type of this field is nilable +DeviceInfo+ (+object+).
214
220
  def authenticate(
215
221
  organization_id:,
216
222
  member_id:,
@@ -221,7 +227,8 @@ module StytchB2B
221
227
  session_duration_minutes: nil,
222
228
  session_custom_claims: nil,
223
229
  set_mfa_enrollment: nil,
224
- set_default_mfa: nil
230
+ set_default_mfa: nil,
231
+ telemetry_id: nil
225
232
  )
226
233
  headers = {}
227
234
  request = {
@@ -236,6 +243,7 @@ module StytchB2B
236
243
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
237
244
  request[:set_mfa_enrollment] = set_mfa_enrollment unless set_mfa_enrollment.nil?
238
245
  request[:set_default_mfa] = set_default_mfa unless set_default_mfa.nil?
246
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
239
247
 
240
248
  post_request('/v1/b2b/otps/sms/authenticate', request, headers)
241
249
  end
@@ -383,6 +391,9 @@ module StytchB2B
383
391
  # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
384
392
  #
385
393
  # The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
394
+ # telemetry_id::
395
+ # If the `telemetry_id` is passed, as part of this request, Stytch will call the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) and store the associated fingerprints and IPGEO information for the Member. Your workspace must be enabled for Device Fingerprinting to use this feature.
396
+ # The type of this field is nilable +String+.
386
397
  #
387
398
  # == Returns:
388
399
  # An object with the following fields:
@@ -428,6 +439,9 @@ module StytchB2B
428
439
  # primary_required::
429
440
  # (no documentation yet)
430
441
  # The type of this field is nilable +PrimaryRequired+ (+object+).
442
+ # member_device::
443
+ # If a valid `telemetry_id` was passed in the request and the [Fingerprint Lookup API](https://stytch.com/docs/fraud/api/fingerprint-lookup) returned results, the `member_device` response field will contain information about the member's device attributes.
444
+ # The type of this field is nilable +DeviceInfo+ (+object+).
431
445
  def authenticate(
432
446
  organization_id:,
433
447
  email_address:,
@@ -437,7 +451,8 @@ module StytchB2B
437
451
  intermediate_session_token: nil,
438
452
  session_duration_minutes: nil,
439
453
  session_custom_claims: nil,
440
- locale: nil
454
+ locale: nil,
455
+ telemetry_id: nil
441
456
  )
442
457
  headers = {}
443
458
  request = {
@@ -451,6 +466,7 @@ module StytchB2B
451
466
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
452
467
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
453
468
  request[:locale] = locale unless locale.nil?
469
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
454
470
 
455
471
  post_request('/v1/b2b/otps/email/authenticate', request, headers)
456
472
  end