stytch 10.18.0 → 10.19.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 +4 -4
- data/lib/stytch/b2b_discovery.rb +23 -22
- data/lib/stytch/b2b_organizations.rb +292 -2
- data/lib/stytch/b2b_passwords.rb +6 -6
- data/lib/stytch/b2b_sessions.rb +15 -12
- data/lib/stytch/crypto_wallets.rb +2 -2
- data/lib/stytch/fraud.rb +1 -1
- data/lib/stytch/impersonation.rb +1 -1
- data/lib/stytch/magic_links.rb +19 -9
- data/lib/stytch/oauth.rb +2 -2
- data/lib/stytch/otps.rb +11 -11
- data/lib/stytch/passwords.rb +13 -13
- data/lib/stytch/sessions.rb +9 -9
- data/lib/stytch/totps.rb +6 -6
- data/lib/stytch/users.rb +76 -7
- data/lib/stytch/version.rb +1 -1
- data/lib/stytch/webauthn.rb +6 -6
- 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: 2e638ef6189392a14cc312951f14b9882c9c9479bb9bccd2e87884576cd944a8
|
4
|
+
data.tar.gz: c070606c02c73bb54aa6b90c755491e6da2d38e7a5dff07ac661712bef1c6e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48b5f1e1a8a5b25061175848c74997918af834e0d499deace18fcbf670885821b3281158b8a41a8d6ada238b372ceb61a61a8bb48a2ee406be984c058ee88b1
|
7
|
+
data.tar.gz: 4400e4caea7dcedd1e81fdea293997583bb4eebe6f4b5687f2ab0f0a60bc9ef22e95f7a377ab4c6064a6b4d36f91066dc8f4425e4fffa4eb2e362b063799f55b
|
data/lib/stytch/b2b_discovery.rb
CHANGED
@@ -27,20 +27,21 @@ module StytchB2B
|
|
27
27
|
@connection = connection
|
28
28
|
end
|
29
29
|
|
30
|
-
# Exchange an Intermediate Session for a fully realized [Member Session](https://stytch.com/docs/b2b/api/session-object)
|
31
|
-
# This operation consumes the Intermediate Session.
|
30
|
+
# Exchange an Intermediate Session for a fully realized [Member Session](https://stytch.com/docs/b2b/api/session-object) for the [Organization](https://stytch.com/docs/b2b/api/organization-object) that the user wishes to log into.
|
32
31
|
#
|
33
|
-
# This endpoint can be used to accept invites and
|
32
|
+
# This endpoint can be used to accept invites and into a new Organization on the basis of the user's email domain or OAuth tenant.
|
34
33
|
#
|
35
|
-
# If the
|
36
|
-
# The `intermediate_session_token` will not be consumed and instead will be returned in the response.
|
37
|
-
# The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.
|
38
|
-
# The `intermediate_session_token` can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to join a different Organization or create a new one.
|
39
|
-
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
34
|
+
# If the user **has** already satisfied the authentication requirements of the Organization they are trying to exchange into and logged in with a method that verifies their email address, this API will return `member_authenticated: true` and a `session_token` and `session_jwt`.
|
40
35
|
#
|
41
|
-
# If the
|
42
|
-
#
|
43
|
-
#
|
36
|
+
# If the user **has not** satisfied the primary or secondary authentication requirements of the Organization they are attempting to exchange into or is JIT Provisioning but did not log in via a method that provides email verification, this API will return `member_authenticated: false` and an `intermediate_session_token`.
|
37
|
+
#
|
38
|
+
# If `primary_required` is returned, prompt the user to fulfill the Organization's auth requirements using the options returned in `primary_required.allowed_auth_methods`.
|
39
|
+
#
|
40
|
+
# If `primary_required` is null and `mfa_required` is set, check `mfa_required.member_options` to determine if the Member has SMS OTP or TOTP set up for MFA and prompt accordingly. If the Member has SMS OTP, check `mfa_required.secondary_auth_initiated` to see if the OTP has already been sent.
|
41
|
+
#
|
42
|
+
# Include the `intermediate_session_token` returned above when calling the `authenticate()` method that the user needed to perform. Once the user has completed the authentication requirements they were missing, they will be granted a full `session_token` and `session_jwt` to indicate they have successfully logged into the Organization.
|
43
|
+
#
|
44
|
+
# The `intermediate_session_token` can also be used with the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization instead of joining an existing one.
|
44
45
|
#
|
45
46
|
# == Parameters:
|
46
47
|
# intermediate_session_token::
|
@@ -143,21 +144,21 @@ module StytchB2B
|
|
143
144
|
@connection = connection
|
144
145
|
end
|
145
146
|
|
146
|
-
#
|
147
|
-
# [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object).
|
147
|
+
# This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a authentication flow to create a new
|
148
|
+
# [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object) and log the user in. If the user wants to log into an existing Organization, use the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) instead.
|
148
149
|
#
|
149
|
-
#
|
150
|
+
# Stytch **requires that users verify their email address** prior to creating a new Organization in order to prevent Account Takeover (ATO) attacks and phishing.
|
150
151
|
#
|
151
|
-
#
|
152
|
+
# If the user authenticated using a method that **does not** provide real-time email verification (returning password auth, Github/Slack/Hubspot OAuth) this API will return `member_authenticated: false` and an `intermediate_session_token` to indicate that the user must perform additional authentication via one of the options listed in `primary_required.allowed_auth_methods` to finish logging in.
|
152
153
|
#
|
153
|
-
#
|
154
|
-
#
|
154
|
+
# If you specified an `mfa_policy: REQUIRED_FOR_ALL` in the request, this API will return `member_authenticated: false`, an `intermediate_session_token`, and `mfa_required` in order to indicate that you must prompt the user to enroll in MFA.
|
155
|
+
#
|
156
|
+
# Include the `intermediate_session_token` when calling the `authenticate()` method that the user needed to perform to verify their email or enroll in MFA. Once the user has completed the authentication requirements they were missing, they will be granted a full `session_token` and `session_jwt` and be successfully logged in.
|
155
157
|
#
|
156
|
-
# If the
|
157
|
-
#
|
158
|
-
# The
|
159
|
-
#
|
160
|
-
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
158
|
+
# If the user logged in with a method that **does** provide real-time email verification (Email Magic Links, Email OTP, Google/Microsoft OAuth, initial email verification when creating a new password) this API will return `member_authenticated: true` and a `session_jwt` and `session_token` to indicate that the user has successfully logged in.
|
159
|
+
#
|
160
|
+
# The Member created by this endpoint will automatically be granted the `stytch_admin` Role. See the
|
161
|
+
# [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/stytch-default) for more details on this Role.
|
161
162
|
#
|
162
163
|
# == Parameters:
|
163
164
|
# intermediate_session_token::
|
@@ -48,6 +48,44 @@ module StytchB2B
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
class ConnectedAppsRequestOptions
|
52
|
+
# Optional authorization object.
|
53
|
+
# Pass in an active Stytch Member session token or session JWT and the request
|
54
|
+
# will be run using that member's permissions.
|
55
|
+
attr_accessor :authorization
|
56
|
+
|
57
|
+
def initialize(
|
58
|
+
authorization: nil
|
59
|
+
)
|
60
|
+
@authorization = authorization
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_headers
|
64
|
+
headers = {}
|
65
|
+
headers.merge!(@authorization.to_headers) if authorization
|
66
|
+
headers
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class GetConnectedAppRequestOptions
|
71
|
+
# Optional authorization object.
|
72
|
+
# Pass in an active Stytch Member session token or session JWT and the request
|
73
|
+
# will be run using that member's permissions.
|
74
|
+
attr_accessor :authorization
|
75
|
+
|
76
|
+
def initialize(
|
77
|
+
authorization: nil
|
78
|
+
)
|
79
|
+
@authorization = authorization
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_headers
|
83
|
+
headers = {}
|
84
|
+
headers.merge!(@authorization.to_headers) if authorization
|
85
|
+
headers
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
51
89
|
include Stytch::RequestHelper
|
52
90
|
attr_reader :members
|
53
91
|
|
@@ -164,6 +202,18 @@ module StytchB2B
|
|
164
202
|
# claimed_email_domains::
|
165
203
|
# A list of email domains that are claimed by the Organization.
|
166
204
|
# The type of this field is nilable list of +String+.
|
205
|
+
# first_party_connected_apps_allowed_type::
|
206
|
+
# (no documentation yet)
|
207
|
+
# The type of this field is nilable +CreateRequestFirstPartyConnectedAppsAllowedType+ (string enum).
|
208
|
+
# allowed_first_party_connected_apps::
|
209
|
+
# (no documentation yet)
|
210
|
+
# The type of this field is nilable list of +String+.
|
211
|
+
# third_party_connected_apps_allowed_type::
|
212
|
+
# (no documentation yet)
|
213
|
+
# The type of this field is nilable +CreateRequestThirdPartyConnectedAppsAllowedType+ (string enum).
|
214
|
+
# allowed_third_party_connected_apps::
|
215
|
+
# (no documentation yet)
|
216
|
+
# The type of this field is nilable list of +String+.
|
167
217
|
#
|
168
218
|
# == Returns:
|
169
219
|
# An object with the following fields:
|
@@ -193,7 +243,11 @@ module StytchB2B
|
|
193
243
|
allowed_mfa_methods: nil,
|
194
244
|
oauth_tenant_jit_provisioning: nil,
|
195
245
|
allowed_oauth_tenants: nil,
|
196
|
-
claimed_email_domains: nil
|
246
|
+
claimed_email_domains: nil,
|
247
|
+
first_party_connected_apps_allowed_type: nil,
|
248
|
+
allowed_first_party_connected_apps: nil,
|
249
|
+
third_party_connected_apps_allowed_type: nil,
|
250
|
+
allowed_third_party_connected_apps: nil
|
197
251
|
)
|
198
252
|
headers = {}
|
199
253
|
request = {
|
@@ -215,6 +269,10 @@ module StytchB2B
|
|
215
269
|
request[:oauth_tenant_jit_provisioning] = oauth_tenant_jit_provisioning unless oauth_tenant_jit_provisioning.nil?
|
216
270
|
request[:allowed_oauth_tenants] = allowed_oauth_tenants unless allowed_oauth_tenants.nil?
|
217
271
|
request[:claimed_email_domains] = claimed_email_domains unless claimed_email_domains.nil?
|
272
|
+
request[:first_party_connected_apps_allowed_type] = first_party_connected_apps_allowed_type unless first_party_connected_apps_allowed_type.nil?
|
273
|
+
request[:allowed_first_party_connected_apps] = allowed_first_party_connected_apps unless allowed_first_party_connected_apps.nil?
|
274
|
+
request[:third_party_connected_apps_allowed_type] = third_party_connected_apps_allowed_type unless third_party_connected_apps_allowed_type.nil?
|
275
|
+
request[:allowed_third_party_connected_apps] = allowed_third_party_connected_apps unless allowed_third_party_connected_apps.nil?
|
218
276
|
|
219
277
|
post_request('/v1/b2b/organizations', request, headers)
|
220
278
|
end
|
@@ -397,6 +455,18 @@ module StytchB2B
|
|
397
455
|
# claimed_email_domains::
|
398
456
|
# A list of email domains that are claimed by the Organization.
|
399
457
|
# The type of this field is nilable list of +String+.
|
458
|
+
# first_party_connected_apps_allowed_type::
|
459
|
+
# (no documentation yet)
|
460
|
+
# The type of this field is nilable +UpdateRequestFirstPartyConnectedAppsAllowedType+ (string enum).
|
461
|
+
# allowed_first_party_connected_apps::
|
462
|
+
# (no documentation yet)
|
463
|
+
# The type of this field is nilable list of +String+.
|
464
|
+
# third_party_connected_apps_allowed_type::
|
465
|
+
# (no documentation yet)
|
466
|
+
# The type of this field is nilable +UpdateRequestThirdPartyConnectedAppsAllowedType+ (string enum).
|
467
|
+
# allowed_third_party_connected_apps::
|
468
|
+
# (no documentation yet)
|
469
|
+
# The type of this field is nilable list of +String+.
|
400
470
|
#
|
401
471
|
# == Returns:
|
402
472
|
# An object with the following fields:
|
@@ -433,6 +503,10 @@ module StytchB2B
|
|
433
503
|
oauth_tenant_jit_provisioning: nil,
|
434
504
|
allowed_oauth_tenants: nil,
|
435
505
|
claimed_email_domains: nil,
|
506
|
+
first_party_connected_apps_allowed_type: nil,
|
507
|
+
allowed_first_party_connected_apps: nil,
|
508
|
+
third_party_connected_apps_allowed_type: nil,
|
509
|
+
allowed_third_party_connected_apps: nil,
|
436
510
|
method_options: nil
|
437
511
|
)
|
438
512
|
headers = {}
|
@@ -457,6 +531,10 @@ module StytchB2B
|
|
457
531
|
request[:oauth_tenant_jit_provisioning] = oauth_tenant_jit_provisioning unless oauth_tenant_jit_provisioning.nil?
|
458
532
|
request[:allowed_oauth_tenants] = allowed_oauth_tenants unless allowed_oauth_tenants.nil?
|
459
533
|
request[:claimed_email_domains] = claimed_email_domains unless claimed_email_domains.nil?
|
534
|
+
request[:first_party_connected_apps_allowed_type] = first_party_connected_apps_allowed_type unless first_party_connected_apps_allowed_type.nil?
|
535
|
+
request[:allowed_first_party_connected_apps] = allowed_first_party_connected_apps unless allowed_first_party_connected_apps.nil?
|
536
|
+
request[:third_party_connected_apps_allowed_type] = third_party_connected_apps_allowed_type unless third_party_connected_apps_allowed_type.nil?
|
537
|
+
request[:allowed_third_party_connected_apps] = allowed_third_party_connected_apps unless allowed_third_party_connected_apps.nil?
|
460
538
|
|
461
539
|
put_request("/v1/b2b/organizations/#{organization_id}", request, headers)
|
462
540
|
end
|
@@ -541,6 +619,92 @@ module StytchB2B
|
|
541
619
|
get_request(request, headers)
|
542
620
|
end
|
543
621
|
|
622
|
+
# Retrieves a list of Connected Apps for the Organization that have been installed by Members. Installation comprises
|
623
|
+
# successful completion of an authorization flow with a Connected App that has not been revoked.
|
624
|
+
#
|
625
|
+
# Connected Apps may be uninstalled if an Organization changes its `first_party_connected_apps_allowed_type`
|
626
|
+
# or `third_party_connected_apps_allowed_type` policies.
|
627
|
+
#
|
628
|
+
# == Parameters:
|
629
|
+
# organization_id::
|
630
|
+
# 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 here as a convenience.
|
631
|
+
# The type of this field is +String+.
|
632
|
+
#
|
633
|
+
# == Returns:
|
634
|
+
# An object with the following fields:
|
635
|
+
# request_id::
|
636
|
+
# 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.
|
637
|
+
# The type of this field is +String+.
|
638
|
+
# connected_apps::
|
639
|
+
# (no documentation yet)
|
640
|
+
# The type of this field is list of +OrganizationConnectedApp+ (+object+).
|
641
|
+
# status_code::
|
642
|
+
# (no documentation yet)
|
643
|
+
# The type of this field is +Integer+.
|
644
|
+
#
|
645
|
+
# == Method Options:
|
646
|
+
# This method supports an optional +StytchB2B::Organizations::ConnectedAppsRequestOptions+ object which will modify the headers sent in the HTTP request.
|
647
|
+
def connected_apps(
|
648
|
+
organization_id:,
|
649
|
+
method_options: nil
|
650
|
+
)
|
651
|
+
headers = {}
|
652
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
653
|
+
query_params = {}
|
654
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/connected_apps", query_params)
|
655
|
+
get_request(request, headers)
|
656
|
+
end
|
657
|
+
|
658
|
+
# Get Connected App for Organization retrieves information about the specified Connected App as well as a list of the
|
659
|
+
# Organization's Members who have the App installed along with the scopes they requested at completion of their last
|
660
|
+
# authorization with the App.
|
661
|
+
#
|
662
|
+
# == Parameters:
|
663
|
+
# organization_id::
|
664
|
+
# 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 here as a convenience.
|
665
|
+
# The type of this field is +String+.
|
666
|
+
# connected_app_id::
|
667
|
+
# The ID of the Connected App.
|
668
|
+
# The type of this field is +String+.
|
669
|
+
#
|
670
|
+
# == Returns:
|
671
|
+
# An object with the following fields:
|
672
|
+
# connected_app_id::
|
673
|
+
# The ID of the Connected App.
|
674
|
+
# The type of this field is +String+.
|
675
|
+
# name::
|
676
|
+
# The name of the Connected App.
|
677
|
+
# The type of this field is +String+.
|
678
|
+
# description::
|
679
|
+
# A description of the Connected App.
|
680
|
+
# The type of this field is +String+.
|
681
|
+
# client_type::
|
682
|
+
# The type of Connected App. Supported values are `first_party`, `first_party_public`, `third_party`, and `third_party_public`.
|
683
|
+
# The type of this field is +String+.
|
684
|
+
# active_members::
|
685
|
+
# Details about Members who has installed a Connected App.
|
686
|
+
# The type of this field is list of +OrganizationConnectedAppActiveMember+ (+object+).
|
687
|
+
# status_code::
|
688
|
+
# (no documentation yet)
|
689
|
+
# The type of this field is +Integer+.
|
690
|
+
# logo_url::
|
691
|
+
# (no documentation yet)
|
692
|
+
# The type of this field is nilable +String+.
|
693
|
+
#
|
694
|
+
# == Method Options:
|
695
|
+
# This method supports an optional +StytchB2B::Organizations::GetConnectedAppRequestOptions+ object which will modify the headers sent in the HTTP request.
|
696
|
+
def get_connected_app(
|
697
|
+
organization_id:,
|
698
|
+
connected_app_id:,
|
699
|
+
method_options: nil
|
700
|
+
)
|
701
|
+
headers = {}
|
702
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
703
|
+
query_params = {}
|
704
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/connected_apps/#{connected_app_id}", query_params)
|
705
|
+
get_request(request, headers)
|
706
|
+
end
|
707
|
+
|
544
708
|
class Members
|
545
709
|
class UpdateRequestOptions
|
546
710
|
# Optional authorization object.
|
@@ -694,6 +858,25 @@ module StytchB2B
|
|
694
858
|
end
|
695
859
|
end
|
696
860
|
|
861
|
+
class GetConnectedAppsRequestOptions
|
862
|
+
# Optional authorization object.
|
863
|
+
# Pass in an active Stytch Member session token or session JWT and the request
|
864
|
+
# will be run using that member's permissions.
|
865
|
+
attr_accessor :authorization
|
866
|
+
|
867
|
+
def initialize(
|
868
|
+
authorization: nil
|
869
|
+
)
|
870
|
+
@authorization = authorization
|
871
|
+
end
|
872
|
+
|
873
|
+
def to_headers
|
874
|
+
headers = {}
|
875
|
+
headers.merge!(@authorization.to_headers) if authorization
|
876
|
+
headers
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
697
880
|
class CreateRequestOptions
|
698
881
|
# Optional authorization object.
|
699
882
|
# Pass in an active Stytch Member session token or session JWT and the request
|
@@ -714,12 +897,13 @@ module StytchB2B
|
|
714
897
|
end
|
715
898
|
|
716
899
|
include Stytch::RequestHelper
|
717
|
-
attr_reader :oauth_providers
|
900
|
+
attr_reader :oauth_providers, :connected_apps
|
718
901
|
|
719
902
|
def initialize(connection)
|
720
903
|
@connection = connection
|
721
904
|
|
722
905
|
@oauth_providers = StytchB2B::Organizations::Members::OAuthProviders.new(@connection)
|
906
|
+
@connected_apps = StytchB2B::Organizations::Members::ConnectedApps.new(@connection)
|
723
907
|
end
|
724
908
|
|
725
909
|
# Updates a specified by `organization_id` and `member_id`.
|
@@ -1264,6 +1448,46 @@ module StytchB2B
|
|
1264
1448
|
post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/unlink_retired_email", request, headers)
|
1265
1449
|
end
|
1266
1450
|
|
1451
|
+
# Member Get Connected Apps retrieves a list of Connected Apps with which the Member has successfully completed an
|
1452
|
+
# authorization flow.
|
1453
|
+
# If the Member revokes a Connected App's access (e.g. via the Revoke Connected App endpoint) then the Connected App will
|
1454
|
+
# no longer be returned in the response. A Connected App's access may also be revoked if the Organization's allowed Connected
|
1455
|
+
# App policy changes.
|
1456
|
+
#
|
1457
|
+
# == Parameters:
|
1458
|
+
# organization_id::
|
1459
|
+
# 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 here as a convenience.
|
1460
|
+
# The type of this field is +String+.
|
1461
|
+
# member_id::
|
1462
|
+
# 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.
|
1463
|
+
# The type of this field is +String+.
|
1464
|
+
#
|
1465
|
+
# == Returns:
|
1466
|
+
# An object with the following fields:
|
1467
|
+
# request_id::
|
1468
|
+
# 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.
|
1469
|
+
# The type of this field is +String+.
|
1470
|
+
# connected_apps::
|
1471
|
+
# An array of Connected Apps with which the Member has successfully completed an authorization flow.
|
1472
|
+
# The type of this field is list of +MemberConnectedApp+ (+object+).
|
1473
|
+
# status_code::
|
1474
|
+
# (no documentation yet)
|
1475
|
+
# The type of this field is +Integer+.
|
1476
|
+
#
|
1477
|
+
# == Method Options:
|
1478
|
+
# This method supports an optional +StytchB2B::Organizations::Members::GetConnectedAppsRequestOptions+ object which will modify the headers sent in the HTTP request.
|
1479
|
+
def get_connected_apps(
|
1480
|
+
organization_id:,
|
1481
|
+
member_id:,
|
1482
|
+
method_options: nil
|
1483
|
+
)
|
1484
|
+
headers = {}
|
1485
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
1486
|
+
query_params = {}
|
1487
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/connected_apps", query_params)
|
1488
|
+
get_request(request, headers)
|
1489
|
+
end
|
1490
|
+
|
1267
1491
|
# Creates a. An `organization_id` and `email_address` are required.
|
1268
1492
|
#
|
1269
1493
|
# == Parameters:
|
@@ -1646,6 +1870,72 @@ module StytchB2B
|
|
1646
1870
|
get_request(request, headers)
|
1647
1871
|
end
|
1648
1872
|
end
|
1873
|
+
|
1874
|
+
class ConnectedApps
|
1875
|
+
class RevokeRequestOptions
|
1876
|
+
# Optional authorization object.
|
1877
|
+
# Pass in an active Stytch Member session token or session JWT and the request
|
1878
|
+
# will be run using that member's permissions.
|
1879
|
+
attr_accessor :authorization
|
1880
|
+
|
1881
|
+
def initialize(
|
1882
|
+
authorization: nil
|
1883
|
+
)
|
1884
|
+
@authorization = authorization
|
1885
|
+
end
|
1886
|
+
|
1887
|
+
def to_headers
|
1888
|
+
headers = {}
|
1889
|
+
headers.merge!(@authorization.to_headers) if authorization
|
1890
|
+
headers
|
1891
|
+
end
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
include Stytch::RequestHelper
|
1895
|
+
|
1896
|
+
def initialize(connection)
|
1897
|
+
@connection = connection
|
1898
|
+
end
|
1899
|
+
|
1900
|
+
# Revoke Connected App revokes a Connected App's access to a Member and revokes all active tokens that have been created
|
1901
|
+
# on the Member's behalf. New tokens cannot be created until the Member completes a new authorization flow with the
|
1902
|
+
# Connected App.
|
1903
|
+
#
|
1904
|
+
# == Parameters:
|
1905
|
+
# organization_id::
|
1906
|
+
# 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 here as a convenience.
|
1907
|
+
# The type of this field is +String+.
|
1908
|
+
# member_id::
|
1909
|
+
# 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.
|
1910
|
+
# The type of this field is +String+.
|
1911
|
+
# connected_app_id::
|
1912
|
+
# The ID of the Connected App.
|
1913
|
+
# The type of this field is +String+.
|
1914
|
+
#
|
1915
|
+
# == Returns:
|
1916
|
+
# An object with the following fields:
|
1917
|
+
# request_id::
|
1918
|
+
# 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.
|
1919
|
+
# The type of this field is +String+.
|
1920
|
+
# status_code::
|
1921
|
+
# (no documentation yet)
|
1922
|
+
# The type of this field is +Integer+.
|
1923
|
+
#
|
1924
|
+
# == Method Options:
|
1925
|
+
# This method supports an optional +StytchB2B::Organizations::Members::ConnectedApps::RevokeRequestOptions+ object which will modify the headers sent in the HTTP request.
|
1926
|
+
def revoke(
|
1927
|
+
organization_id:,
|
1928
|
+
member_id:,
|
1929
|
+
connected_app_id:,
|
1930
|
+
method_options: nil
|
1931
|
+
)
|
1932
|
+
headers = {}
|
1933
|
+
headers = headers.merge(method_options.to_headers) unless method_options.nil?
|
1934
|
+
request = {}
|
1935
|
+
|
1936
|
+
post_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/connected_apps/#{connected_app_id}/revoke", request, headers)
|
1937
|
+
end
|
1938
|
+
end
|
1649
1939
|
end
|
1650
1940
|
end
|
1651
1941
|
end
|
data/lib/stytch/b2b_passwords.rb
CHANGED
@@ -35,7 +35,7 @@ module StytchB2B
|
|
35
35
|
#
|
36
36
|
# == Parameters:
|
37
37
|
# password::
|
38
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
38
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
39
39
|
# The type of this field is +String+.
|
40
40
|
# email_address::
|
41
41
|
# The email address of the Member.
|
@@ -237,7 +237,7 @@ module StytchB2B
|
|
237
237
|
# The email address of the Member.
|
238
238
|
# The type of this field is +String+.
|
239
239
|
# password::
|
240
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
240
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
241
241
|
# The type of this field is +String+.
|
242
242
|
# session_token::
|
243
243
|
# A secret token for a given Stytch Session.
|
@@ -477,7 +477,7 @@ module StytchB2B
|
|
477
477
|
# The password reset token to authenticate.
|
478
478
|
# The type of this field is +String+.
|
479
479
|
# password::
|
480
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
480
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
481
481
|
# The type of this field is +String+.
|
482
482
|
# session_token::
|
483
483
|
# Reuse an existing session instead of creating a new one. If you provide a `session_token`, Stytch will update the session.
|
@@ -656,7 +656,7 @@ module StytchB2B
|
|
656
656
|
# 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 here as a convenience.
|
657
657
|
# The type of this field is +String+.
|
658
658
|
# password::
|
659
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
659
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
660
660
|
# The type of this field is +String+.
|
661
661
|
# session_token::
|
662
662
|
# A secret token for a given Stytch Session.
|
@@ -905,7 +905,7 @@ module StytchB2B
|
|
905
905
|
# The email address of the Member.
|
906
906
|
# The type of this field is +String+.
|
907
907
|
# password::
|
908
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
908
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
909
909
|
# The type of this field is +String+.
|
910
910
|
#
|
911
911
|
# == Returns:
|
@@ -1044,7 +1044,7 @@ module StytchB2B
|
|
1044
1044
|
# The password reset token to authenticate.
|
1045
1045
|
# The type of this field is +String+.
|
1046
1046
|
# password::
|
1047
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
1047
|
+
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characters, etc.
|
1048
1048
|
# The type of this field is +String+.
|
1049
1049
|
# pkce_code_verifier::
|
1050
1050
|
# (no documentation yet)
|
data/lib/stytch/b2b_sessions.rb
CHANGED
@@ -231,15 +231,18 @@ module StytchB2B
|
|
231
231
|
|
232
232
|
# Use this endpoint to exchange a's existing session for another session in a different. This can be used to accept an invite, but not to create a new member via domain matching.
|
233
233
|
#
|
234
|
-
# To create a new member via domain
|
234
|
+
# To create a new member via email domain, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
|
235
235
|
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
236
|
+
# If the user **has** already satisfied the authentication requirements of the Organization they are trying to switch into, this API will return `member_authenticated: true` and a `session_token` and `session_jwt`.
|
237
|
+
#
|
238
|
+
# If the user **has not** satisfied the primary or secondary authentication requirements of the Organization they are attempting to switch into, this API will return `member_authenticated: false` and an `intermediate_session_token`.
|
239
|
+
#
|
240
|
+
# If `primary_required` is set, prompt the user to fulfill the Organization's auth requirements using the options returned in `primary_required.allowed_auth_methods`.
|
241
|
+
#
|
242
|
+
# If `primary_required` is null and `mfa_required` is set, check `mfa_required.member_options` to determine if the Member has SMS OTP or TOTP set up for MFA and prompt accordingly. If the Member has SMS OTP, check `mfa_required.secondary_auth_initiated` to see if the OTP has already been sent.
|
243
|
+
#
|
244
|
+
# Include the `intermediate_session_token` returned above when calling the `authenticate()` method that the user needed to perform. Once the user has completed the authentication requirements they were missing, they will be granted a full `session_token` and `session_jwt` to indicate they have successfully logged into the Organization.
|
240
245
|
#
|
241
|
-
# If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.
|
242
|
-
# The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.
|
243
246
|
# 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.
|
244
247
|
# The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.
|
245
248
|
#
|
@@ -318,7 +321,7 @@ module StytchB2B
|
|
318
321
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
319
322
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
320
323
|
# primary_required::
|
321
|
-
#
|
324
|
+
# Information about the primary authentication requirements of the Organization.
|
322
325
|
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
323
326
|
def exchange(
|
324
327
|
organization_id:,
|
@@ -485,13 +488,13 @@ module StytchB2B
|
|
485
488
|
|
486
489
|
# Get the JSON Web Key Set (JWKS) for a project.
|
487
490
|
#
|
488
|
-
# JWKS are rotated every ~6 months. Upon rotation, new JWTs will be signed using the new key, and both keys will be returned by this endpoint for a period of 1 month.
|
491
|
+
# Within the JWKS, the JSON Web Keys are rotated every ~6 months. Upon rotation, new JWTs will be signed using the new key, and both keys will be returned by this endpoint for a period of 1 month.
|
489
492
|
#
|
490
|
-
# JWTs have a set lifetime of 5 minutes, so there will be a 5 minute period where some JWTs will be signed by the old
|
493
|
+
# JWTs have a set lifetime of 5 minutes, so there will be a 5 minute period where some JWTs will be signed by the old keys, and some JWTs will be signed by the new keys. The correct key to use for validation is determined by matching the `kid` value of the JWT and key.
|
491
494
|
#
|
492
|
-
# If you're using one of our [backend SDKs](https://stytch.com/docs/b2b/sdks), the
|
495
|
+
# If you're using one of our [backend SDKs](https://stytch.com/docs/b2b/sdks), the JSON Web Key (JWK) rotation will be handled for you.
|
493
496
|
#
|
494
|
-
# If you're using your own JWT validation library, many have built-in support for
|
497
|
+
# If you're using your own JWT validation library, many have built-in support for JWK rotation, and you'll just need to supply this API endpoint. If not, your application should decide which JWK to use for validation by inspecting the `kid` value.
|
495
498
|
#
|
496
499
|
# See our [How to use Stytch Session JWTs](https://stytch.com/docs/b2b/guides/sessions/resources/using-jwts) guide for more information.
|
497
500
|
#
|
@@ -31,7 +31,7 @@ module Stytch
|
|
31
31
|
# The crypto wallet address to authenticate.
|
32
32
|
# The type of this field is +String+.
|
33
33
|
# user_id::
|
34
|
-
# The unique ID of a specific User. You may use an external_id here if one is set for the user.
|
34
|
+
# The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
|
35
35
|
# The type of this field is nilable +String+.
|
36
36
|
# session_token::
|
37
37
|
# The `session_token` associated with a User's existing Session.
|
@@ -139,7 +139,7 @@ module Stytch
|
|
139
139
|
# session::
|
140
140
|
# If you initiate a Session, by including `session_duration_minutes` in your authenticate call, you'll receive a full Session object in the response.
|
141
141
|
#
|
142
|
-
# See [
|
142
|
+
# See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
|
143
143
|
#
|
144
144
|
# The type of this field is nilable +Session+ (+object+).
|
145
145
|
# siwe_params::
|
data/lib/stytch/fraud.rb
CHANGED
@@ -27,7 +27,7 @@ module Stytch
|
|
27
27
|
@connection = connection
|
28
28
|
end
|
29
29
|
|
30
|
-
# Lookup the associated fingerprint for the `telemetry_id` returned from the `GetTelemetryID` function. Learn more about the different fingerprint types and verdicts in our [DFP guide](https://stytch.com/docs/fraud/guides/device-fingerprinting/overview).
|
30
|
+
# Lookup the associated fingerprint for the `telemetry_id` returned from the `GetTelemetryID()` function. Learn more about the different fingerprint types and verdicts in our [DFP guide](https://stytch.com/docs/fraud/guides/device-fingerprinting/overview).
|
31
31
|
#
|
32
32
|
# Make a decision based on the returned `verdict`:
|
33
33
|
# * `ALLOW` - This is a known valid device grouping or device profile that is part of the default `ALLOW` listed set of known devices by Stytch. This grouping is made up of verified device profiles that match the characteristics of known/authentic traffic origins.
|
data/lib/stytch/impersonation.rb
CHANGED
@@ -49,7 +49,7 @@ module Stytch
|
|
49
49
|
# session::
|
50
50
|
# If you initiate a Session, by including `session_duration_minutes` in your authenticate call, you'll receive a full Session object in the response.
|
51
51
|
#
|
52
|
-
# See [
|
52
|
+
# See [Session object](https://stytch.com/docs/api/session-object) for complete response fields.
|
53
53
|
#
|
54
54
|
# The type of this field is nilable +Session+ (+object+).
|
55
55
|
def authenticate(
|