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.
data/lib/stytch/idp.rb CHANGED
@@ -1,36 +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 Stytch
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 = Stytch::IDP::OAuth.new(@connection)
16
23
  @policy_cache = policy_cache
17
- @non_custom_claim_keys = %w[
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
- ]
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
32
37
  end
33
38
 
39
+ # MANUAL(IDP::introspect_token_network)(SERVICE_METHOD)
40
+ # ADDIMPORT: require 'jwt'
41
+ # ADDIMPORT: require 'json/jwt'
42
+ # ADDIMPORT: require_relative 'errors'
43
+
34
44
  # Introspects a token JWT from an authorization code response.
35
45
  # Access tokens are JWTs signed with the project's JWKs. Refresh tokens are opaque tokens.
36
46
  # Access tokens contain a standard set of claims as well as any custom claims generated from templates.
@@ -102,7 +112,7 @@ module Stytch
102
112
  jwt_response = res
103
113
  return nil unless jwt_response['active']
104
114
 
105
- custom_claims = res.reject { |k, _| @non_custom_claim_keys.include?(k) }
115
+ custom_claims = res.reject { |k, _| non_custom_claim_keys.include?(k) }
106
116
  scope = jwt_response['scope']
107
117
 
108
118
  if authorization_check
@@ -171,18 +181,6 @@ module Stytch
171
181
  authorization_check: nil
172
182
  )
173
183
  scope_claim = 'scope'
174
-
175
- # Create a JWKS loader similar to other classes in the codebase
176
- @cache_last_update = 0
177
- jwks_loader = lambda do |options|
178
- @cached_keys = nil if options[:invalidate] && @cache_last_update < Time.now.to_i - 300
179
- if @cached_keys.nil?
180
- @cached_keys = get_jwks(project_id: @project_id)
181
- @cache_last_update = Time.now.to_i
182
- end
183
- @cached_keys
184
- end
185
-
186
184
  begin
187
185
  decoded_jwt = JWT.decode(
188
186
  access_token,
@@ -190,14 +188,14 @@ module Stytch
190
188
  true,
191
189
  {
192
190
  algorithms: ['RS256'],
193
- jwks: jwks_loader,
191
+ jwks: @jwks_loader,
194
192
  iss: ["stytch.com/#{@project_id}", @connection.url_prefix],
195
193
  aud: @project_id
196
194
  }
197
195
  )[0]
198
196
 
199
197
  generic_claims = decoded_jwt
200
- custom_claims = generic_claims.reject { |k, _| @non_custom_claim_keys.include?(k) }
198
+ custom_claims = generic_claims.reject { |k, _| non_custom_claim_keys.include?(k) }
201
199
  scope = generic_claims[scope_claim]
202
200
 
203
201
  if authorization_check
@@ -231,6 +229,26 @@ module Stytch
231
229
  end
232
230
  end
233
231
 
232
+ private
233
+
234
+ def non_custom_claim_keys
235
+ %w[
236
+ aud
237
+ exp
238
+ iat
239
+ iss
240
+ jti
241
+ nbf
242
+ sub
243
+ active
244
+ client_id
245
+ request_id
246
+ scope
247
+ status_code
248
+ token_type
249
+ ]
250
+ end
251
+
234
252
  # Gets the JWKS for the project.
235
253
  #
236
254
  # == Parameters:
@@ -247,5 +265,213 @@ module Stytch
247
265
  request = request_with_query_params("/v1/sessions/jwks/#{project_id}", query_params)
248
266
  get_request(request, headers)
249
267
  end
268
+
269
+ # ENDMANUAL(IDP::introspect_token_network)
270
+
271
+ class OAuth
272
+ include Stytch::RequestHelper
273
+
274
+ def initialize(connection)
275
+ @connection = connection
276
+ end
277
+
278
+ # Initiates a request for authorization of a Connected App to access a User's account.
279
+ #
280
+ # Call this endpoint using the query parameters from an OAuth Authorization request.
281
+ # This endpoint validates various fields (`scope`, `client_id`, `redirect_uri`, `prompt`, etc...) are correct and returns
282
+ # relevant information for rendering an OAuth Consent Screen.
283
+ #
284
+ # This endpoint returns:
285
+ # - A public representation of the Connected App requesting authorization
286
+ # - Whether _explicit_ user consent must be granted before proceeding with the authorization
287
+ # - A list of scopes the user has the ability to grant the Connected App
288
+ #
289
+ # Use this response to prompt the user for consent (if necessary) before calling the [Submit OAuth Authorization](https://stytch.com/docs/api/connected-apps-oauth-authorize) endpoint.
290
+ #
291
+ # Exactly one of the following must be provided to identify the user granting authorization:
292
+ # - `user_id`
293
+ # - `session_token`
294
+ # - `session_jwt`
295
+ #
296
+ # If a `session_token` or `session_jwt` is passed, the OAuth Authorization will be linked to the user's session for tracking purposes.
297
+ # One of these fields must be used if the Connected App intends to complete the [Exchange Access Token](https://stytch.com/docs/api/connected-app-access-token-exchange) flow.
298
+ #
299
+ # == Parameters:
300
+ # client_id::
301
+ # The ID of the Connected App client.
302
+ # The type of this field is +String+.
303
+ # redirect_uri::
304
+ # 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.
305
+ # The type of this field is +String+.
306
+ # response_type::
307
+ # The OAuth 2.0 response type. For authorization code flows this value is `code`.
308
+ # The type of this field is +String+.
309
+ # scopes::
310
+ # An array of scopes requested by the client.
311
+ # The type of this field is list of +String+.
312
+ # user_id::
313
+ # The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
314
+ # The type of this field is nilable +String+.
315
+ # session_token::
316
+ # The `session_token` associated with a User's existing Session.
317
+ # The type of this field is nilable +String+.
318
+ # session_jwt::
319
+ # The `session_jwt` associated with a User's existing Session.
320
+ # The type of this field is nilable +String+.
321
+ # prompt::
322
+ # Space separated list that specifies how the Authorization Server should prompt the user for reauthentication and consent. Only `consent` is supported today.
323
+ # The type of this field is nilable +String+.
324
+ #
325
+ # == Returns:
326
+ # An object with the following fields:
327
+ # request_id::
328
+ # 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.
329
+ # The type of this field is +String+.
330
+ # user_id::
331
+ # The unique ID of the affected User.
332
+ # The type of this field is +String+.
333
+ # user::
334
+ # The `user` object affected by this API call. See the [Get user endpoint](https://stytch.com/docs/api/get-user) for complete response field details.
335
+ # The type of this field is +User+ (+object+).
336
+ # client::
337
+ # (no documentation yet)
338
+ # The type of this field is +ConnectedAppPublic+ (+object+).
339
+ # consent_required::
340
+ # Whether the user must provide explicit consent for the authorization request.
341
+ # The type of this field is +Boolean+.
342
+ # scope_results::
343
+ # Details about each requested scope.
344
+ # The type of this field is list of +ScopeResult+ (+object+).
345
+ # status_code::
346
+ # (no documentation yet)
347
+ # The type of this field is +Integer+.
348
+ def authorize_start(
349
+ client_id:,
350
+ redirect_uri:,
351
+ response_type:,
352
+ scopes:,
353
+ user_id: nil,
354
+ session_token: nil,
355
+ session_jwt: nil,
356
+ prompt: nil
357
+ )
358
+ headers = {}
359
+ request = {
360
+ client_id: client_id,
361
+ redirect_uri: redirect_uri,
362
+ response_type: response_type,
363
+ scopes: scopes
364
+ }
365
+ request[:user_id] = user_id unless user_id.nil?
366
+ request[:session_token] = session_token unless session_token.nil?
367
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
368
+ request[:prompt] = prompt unless prompt.nil?
369
+
370
+ post_request('/v1/idp/oauth/authorize/start', request, headers)
371
+ end
372
+
373
+ # Completes a request for authorization of a Connected App to access a User's account.
374
+ #
375
+ # Call this endpoint using the query parameters from an OAuth Authorization request, after previously validating those parameters using the
376
+ # [Preflight Check](https://stytch.com/docs/api/connected-apps-oauth-authorize-start) API.
377
+ # Note that this endpoint takes in a few additional parameters the preflight check does not- `state`, `nonce`, and `code_challenge`.
378
+ #
379
+ # If the authorization was successful, the `redirect_uri` will contain a valid `authorization_code` embedded as a query parameter.
380
+ # If the authorization was unsuccessful, the `redirect_uri` will contain an OAuth2.1 `error_code`.
381
+ # In both cases, redirect the user to the location for the response to be consumed by the Connected App.
382
+ #
383
+ # Exactly one of the following must be provided to identify the user granting authorization:
384
+ # - `user_id`
385
+ # - `session_token`
386
+ # - `session_jwt`
387
+ #
388
+ # If a `session_token` or `session_jwt` is passed, the OAuth Authorization will be linked to the user's session for tracking purposes.
389
+ # One of these fields must be used if the Connected App intends to complete the [Exchange Access Token](https://stytch.com/docs/api/connected-app-access-token-exchange) flow.
390
+ #
391
+ # == Parameters:
392
+ # consent_granted::
393
+ # Indicates whether the user granted the requested scopes.
394
+ # The type of this field is +Boolean+.
395
+ # scopes::
396
+ # An array of scopes requested by the client.
397
+ # The type of this field is list of +String+.
398
+ # client_id::
399
+ # The ID of the Connected App client.
400
+ # The type of this field is +String+.
401
+ # redirect_uri::
402
+ # 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.
403
+ # The type of this field is +String+.
404
+ # response_type::
405
+ # The OAuth 2.0 response type. For authorization code flows this value is `code`.
406
+ # The type of this field is +String+.
407
+ # user_id::
408
+ # The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
409
+ # The type of this field is nilable +String+.
410
+ # session_token::
411
+ # The `session_token` associated with a User's existing Session.
412
+ # The type of this field is nilable +String+.
413
+ # session_jwt::
414
+ # The `session_jwt` associated with a User's existing Session.
415
+ # The type of this field is nilable +String+.
416
+ # prompt::
417
+ # Space separated list that specifies how the Authorization Server should prompt the user for reauthentication and consent. Only `consent` is supported today.
418
+ # The type of this field is nilable +String+.
419
+ # state::
420
+ # An opaque value used to maintain state between the request and callback.
421
+ # The type of this field is nilable +String+.
422
+ # nonce::
423
+ # A string used to associate a client session with an ID token to mitigate replay attacks.
424
+ # The type of this field is nilable +String+.
425
+ # code_challenge::
426
+ # A base64url encoded challenge derived from the code verifier for PKCE flows.
427
+ # The type of this field is nilable +String+.
428
+ #
429
+ # == Returns:
430
+ # An object with the following fields:
431
+ # request_id::
432
+ # 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.
433
+ # The type of this field is +String+.
434
+ # redirect_uri::
435
+ # 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.
436
+ # The type of this field is +String+.
437
+ # status_code::
438
+ # (no documentation yet)
439
+ # The type of this field is +Integer+.
440
+ # authorization_code::
441
+ # A one-time use code that can be exchanged for tokens.
442
+ # The type of this field is nilable +String+.
443
+ def authorize(
444
+ consent_granted:,
445
+ scopes:,
446
+ client_id:,
447
+ redirect_uri:,
448
+ response_type:,
449
+ user_id: nil,
450
+ session_token: nil,
451
+ session_jwt: nil,
452
+ prompt: nil,
453
+ state: nil,
454
+ nonce: nil,
455
+ code_challenge: nil
456
+ )
457
+ headers = {}
458
+ request = {
459
+ consent_granted: consent_granted,
460
+ scopes: scopes,
461
+ client_id: client_id,
462
+ redirect_uri: redirect_uri,
463
+ response_type: response_type
464
+ }
465
+ request[:user_id] = user_id unless user_id.nil?
466
+ request[:session_token] = session_token unless session_token.nil?
467
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
468
+ request[:prompt] = prompt unless prompt.nil?
469
+ request[:state] = state unless state.nil?
470
+ request[:nonce] = nonce unless nonce.nil?
471
+ request[:code_challenge] = code_challenge unless code_challenge.nil?
472
+
473
+ post_request('/v1/idp/oauth/authorize', request, headers)
474
+ end
475
+ end
250
476
  end
251
477
  end
@@ -60,6 +60,9 @@ module Stytch
60
60
  # code_verifier::
61
61
  # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
62
62
  # The type of this field is nilable +String+.
63
+ # telemetry_id::
64
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
65
+ # The type of this field is nilable +String+.
63
66
  #
64
67
  # == Returns:
65
68
  # An object with the following fields:
@@ -93,6 +96,9 @@ module Stytch
93
96
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
94
97
  #
95
98
  # The type of this field is nilable +Session+ (+object+).
99
+ # user_device::
100
+ # 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 `user_device` response field will contain information about the user's device attributes.
101
+ # The type of this field is nilable +DeviceInfo+ (+object+).
96
102
  def authenticate(
97
103
  token:,
98
104
  attributes: nil,
@@ -101,7 +107,8 @@ module Stytch
101
107
  session_duration_minutes: nil,
102
108
  session_jwt: nil,
103
109
  session_custom_claims: nil,
104
- code_verifier: nil
110
+ code_verifier: nil,
111
+ telemetry_id: nil
105
112
  )
106
113
  headers = {}
107
114
  request = {
@@ -114,6 +121,7 @@ module Stytch
114
121
  request[:session_jwt] = session_jwt unless session_jwt.nil?
115
122
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
116
123
  request[:code_verifier] = code_verifier unless code_verifier.nil?
124
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
117
125
 
118
126
  post_request('/v1/magic_links/authenticate', request, headers)
119
127
  end
data/lib/stytch/oauth.rb CHANGED
@@ -101,6 +101,9 @@ module Stytch
101
101
  # code_verifier::
102
102
  # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
103
103
  # The type of this field is nilable +String+.
104
+ # telemetry_id::
105
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
106
+ # The type of this field is nilable +String+.
104
107
  #
105
108
  # == Returns:
106
109
  # An object with the following fields:
@@ -145,13 +148,17 @@ module Stytch
145
148
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
146
149
  #
147
150
  # The type of this field is nilable +Session+ (+object+).
151
+ # user_device::
152
+ # 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 `user_device` response field will contain information about the user's device attributes.
153
+ # The type of this field is nilable +DeviceInfo+ (+object+).
148
154
  def authenticate(
149
155
  token:,
150
156
  session_token: nil,
151
157
  session_duration_minutes: nil,
152
158
  session_jwt: nil,
153
159
  session_custom_claims: nil,
154
- code_verifier: nil
160
+ code_verifier: nil,
161
+ telemetry_id: nil
155
162
  )
156
163
  headers = {}
157
164
  request = {
@@ -162,6 +169,7 @@ module Stytch
162
169
  request[:session_jwt] = session_jwt unless session_jwt.nil?
163
170
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
164
171
  request[:code_verifier] = code_verifier unless code_verifier.nil?
172
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
165
173
 
166
174
  post_request('/v1/oauth/authenticate', request, headers)
167
175
  end
data/lib/stytch/otps.rb CHANGED
@@ -58,6 +58,9 @@ module Stytch
58
58
  #
59
59
  # Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
60
60
  # The type of this field is nilable +object+.
61
+ # telemetry_id::
62
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
63
+ # The type of this field is nilable +String+.
61
64
  #
62
65
  # == Returns:
63
66
  # An object with the following fields:
@@ -91,6 +94,9 @@ module Stytch
91
94
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
92
95
  #
93
96
  # The type of this field is nilable +Session+ (+object+).
97
+ # user_device::
98
+ # 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 `user_device` response field will contain information about the user's device attributes.
99
+ # The type of this field is nilable +DeviceInfo+ (+object+).
94
100
  def authenticate(
95
101
  method_id:,
96
102
  code:,
@@ -99,7 +105,8 @@ module Stytch
99
105
  session_token: nil,
100
106
  session_duration_minutes: nil,
101
107
  session_jwt: nil,
102
- session_custom_claims: nil
108
+ session_custom_claims: nil,
109
+ telemetry_id: nil
103
110
  )
104
111
  headers = {}
105
112
  request = {
@@ -112,6 +119,7 @@ module Stytch
112
119
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
113
120
  request[:session_jwt] = session_jwt unless session_jwt.nil?
114
121
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
122
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
115
123
 
116
124
  post_request('/v1/otps/authenticate', request, headers)
117
125
  end
@@ -61,6 +61,9 @@ module Stytch
61
61
  # name::
62
62
  # The name of the user. Each field in the name object is optional.
63
63
  # The type of this field is nilable +Name+ (+object+).
64
+ # telemetry_id::
65
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
66
+ # The type of this field is nilable +String+.
64
67
  #
65
68
  # == Returns:
66
69
  # An object with the following fields:
@@ -91,6 +94,9 @@ module Stytch
91
94
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
92
95
  #
93
96
  # The type of this field is nilable +Session+ (+object+).
97
+ # user_device::
98
+ # 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 `user_device` response field will contain information about the user's device attributes.
99
+ # The type of this field is nilable +DeviceInfo+ (+object+).
94
100
  def create(
95
101
  email:,
96
102
  password:,
@@ -98,7 +104,8 @@ module Stytch
98
104
  session_custom_claims: nil,
99
105
  trusted_metadata: nil,
100
106
  untrusted_metadata: nil,
101
- name: nil
107
+ name: nil,
108
+ telemetry_id: nil
102
109
  )
103
110
  headers = {}
104
111
  request = {
@@ -110,6 +117,7 @@ module Stytch
110
117
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
111
118
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
112
119
  request[:name] = name unless name.nil?
120
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
113
121
 
114
122
  post_request('/v1/passwords', request, headers)
115
123
  end
@@ -151,6 +159,9 @@ module Stytch
151
159
  #
152
160
  # Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
153
161
  # The type of this field is nilable +object+.
162
+ # telemetry_id::
163
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
164
+ # The type of this field is nilable +String+.
154
165
  #
155
166
  # == Returns:
156
167
  # An object with the following fields:
@@ -178,13 +189,17 @@ module Stytch
178
189
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
179
190
  #
180
191
  # The type of this field is nilable +Session+ (+object+).
192
+ # user_device::
193
+ # 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 `user_device` response field will contain information about the user's device attributes.
194
+ # The type of this field is nilable +DeviceInfo+ (+object+).
181
195
  def authenticate(
182
196
  email:,
183
197
  password:,
184
198
  session_token: nil,
185
199
  session_duration_minutes: nil,
186
200
  session_jwt: nil,
187
- session_custom_claims: nil
201
+ session_custom_claims: nil,
202
+ telemetry_id: nil
188
203
  )
189
204
  headers = {}
190
205
  request = {
@@ -195,6 +210,7 @@ module Stytch
195
210
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
196
211
  request[:session_jwt] = session_jwt unless session_jwt.nil?
197
212
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
213
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
198
214
 
199
215
  post_request('/v1/passwords/authenticate', request, headers)
200
216
  end
@@ -311,7 +327,8 @@ module Stytch
311
327
  # If a new user is created, this will set an identifier that can be used in API calls wherever a user_id is expected. This is a string consisting of alphanumeric, `.`, `_`, `-`, or `|` characters with a maximum length of 128 characters.
312
328
  # The type of this field is nilable +String+.
313
329
  # roles::
314
- # (no documentation yet)
330
+ # Roles to explicitly assign to this User.
331
+ # See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.
315
332
  # The type of this field is nilable list of +String+.
316
333
  #
317
334
  # == Returns:
@@ -510,6 +527,9 @@ module Stytch
510
527
  # options::
511
528
  # Specify optional security settings.
512
529
  # The type of this field is nilable +Options+ (+object+).
530
+ # telemetry_id::
531
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
532
+ # The type of this field is nilable +String+.
513
533
  #
514
534
  # == Returns:
515
535
  # An object with the following fields:
@@ -537,6 +557,9 @@ module Stytch
537
557
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
538
558
  #
539
559
  # The type of this field is nilable +Session+ (+object+).
560
+ # user_device::
561
+ # 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 `user_device` response field will contain information about the user's device attributes.
562
+ # The type of this field is nilable +DeviceInfo+ (+object+).
540
563
  def reset(
541
564
  token:,
542
565
  password:,
@@ -546,7 +569,8 @@ module Stytch
546
569
  code_verifier: nil,
547
570
  session_custom_claims: nil,
548
571
  attributes: nil,
549
- options: nil
572
+ options: nil,
573
+ telemetry_id: nil
550
574
  )
551
575
  headers = {}
552
576
  request = {
@@ -560,6 +584,7 @@ module Stytch
560
584
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
561
585
  request[:attributes] = attributes unless attributes.nil?
562
586
  request[:options] = options unless options.nil?
587
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
563
588
 
564
589
  post_request('/v1/passwords/email/reset', request, headers)
565
590
  end
@@ -608,6 +633,9 @@ module Stytch
608
633
  #
609
634
  # Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
610
635
  # The type of this field is nilable +object+.
636
+ # telemetry_id::
637
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
638
+ # The type of this field is nilable +String+.
611
639
  #
612
640
  # == Returns:
613
641
  # An object with the following fields:
@@ -635,6 +663,9 @@ module Stytch
635
663
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
636
664
  #
637
665
  # The type of this field is nilable +Session+ (+object+).
666
+ # user_device::
667
+ # 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 `user_device` response field will contain information about the user's device attributes.
668
+ # The type of this field is nilable +DeviceInfo+ (+object+).
638
669
  def reset(
639
670
  email:,
640
671
  existing_password:,
@@ -642,7 +673,8 @@ module Stytch
642
673
  session_token: nil,
643
674
  session_duration_minutes: nil,
644
675
  session_jwt: nil,
645
- session_custom_claims: nil
676
+ session_custom_claims: nil,
677
+ telemetry_id: nil
646
678
  )
647
679
  headers = {}
648
680
  request = {
@@ -654,6 +686,7 @@ module Stytch
654
686
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
655
687
  request[:session_jwt] = session_jwt unless session_jwt.nil?
656
688
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
689
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
657
690
 
658
691
  post_request('/v1/passwords/existing_password/reset', request, headers)
659
692
  end
@@ -696,6 +729,9 @@ module Stytch
696
729
  #
697
730
  # Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
698
731
  # The type of this field is nilable +object+.
732
+ # telemetry_id::
733
+ # 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 User. Your workspace must be enabled for Device Fingerprinting to use this feature.
734
+ # The type of this field is nilable +String+.
699
735
  #
700
736
  # == Returns:
701
737
  # An object with the following fields:
@@ -723,12 +759,16 @@ module Stytch
723
759
  # See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
724
760
  #
725
761
  # The type of this field is nilable +Session+ (+object+).
762
+ # user_device::
763
+ # 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 `user_device` response field will contain information about the user's device attributes.
764
+ # The type of this field is nilable +DeviceInfo+ (+object+).
726
765
  def reset(
727
766
  password:,
728
767
  session_token: nil,
729
768
  session_jwt: nil,
730
769
  session_duration_minutes: nil,
731
- session_custom_claims: nil
770
+ session_custom_claims: nil,
771
+ telemetry_id: nil
732
772
  )
733
773
  headers = {}
734
774
  request = {
@@ -738,6 +778,7 @@ module Stytch
738
778
  request[:session_jwt] = session_jwt unless session_jwt.nil?
739
779
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
740
780
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
781
+ request[:telemetry_id] = telemetry_id unless telemetry_id.nil?
741
782
 
742
783
  post_request('/v1/passwords/session/reset', request, headers)
743
784
  end