stytch 10.18.0 → 10.20.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_magic_links.rb +3 -0
- data/lib/stytch/b2b_organizations.rb +292 -2
- data/lib/stytch/b2b_otp.rb +6 -3
- data/lib/stytch/b2b_passwords.rb +17 -8
- data/lib/stytch/b2b_sessions.rb +21 -16
- data/lib/stytch/b2b_sso.rb +3 -0
- 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 +12 -10
- 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: c952f51df5bedbec2f8ea1a1067d4f48f6e286ad4d3995a637fbbd9d0f8d2fd2
|
4
|
+
data.tar.gz: f2aefae357b0bffc0d60766e0c135bb4d196f15d7eca7a85aba8a6c4cea6b9a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cbab2c8cec7e1f94a2573ff9e36abe59d511c75e773be046dfe9cd12fd0e17be70b6410581496a3d0a37ed40324fb1f8256628ed329ee3e62d0485efead885f
|
7
|
+
data.tar.gz: 633239b9adaa11ccb7dd0baabb7b5b8ff2259feca39284efee3809cf83cfef2171c317eb2917496ed54ee729174f347c6f240f24111b1b60ade90f9c08f1e1dd
|
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::
|
@@ -124,6 +124,9 @@ module StytchB2B
|
|
124
124
|
# mfa_required::
|
125
125
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
126
126
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
127
|
+
# primary_required::
|
128
|
+
# (no documentation yet)
|
129
|
+
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
127
130
|
def authenticate(
|
128
131
|
magic_links_token:,
|
129
132
|
pkce_code_verifier: nil,
|
@@ -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_otp.rb
CHANGED
@@ -405,9 +405,6 @@ module StytchB2B
|
|
405
405
|
# session_jwt::
|
406
406
|
# The JSON Web Token (JWT) for a given Stytch Session.
|
407
407
|
# The type of this field is +String+.
|
408
|
-
# member_session::
|
409
|
-
# The [Session object](https://stytch.com/docs/b2b/api/session-object).
|
410
|
-
# The type of this field is +MemberSession+ (+object+).
|
411
408
|
# organization::
|
412
409
|
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
413
410
|
# The type of this field is +Organization+ (+object+).
|
@@ -420,9 +417,15 @@ module StytchB2B
|
|
420
417
|
# status_code::
|
421
418
|
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
422
419
|
# The type of this field is +Integer+.
|
420
|
+
# member_session::
|
421
|
+
# The [Session object](https://stytch.com/docs/b2b/api/session-object).
|
422
|
+
# The type of this field is nilable +MemberSession+ (+object+).
|
423
423
|
# mfa_required::
|
424
424
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
425
425
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
426
|
+
# primary_required::
|
427
|
+
# (no documentation yet)
|
428
|
+
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
426
429
|
def authenticate(
|
427
430
|
organization_id:,
|
428
431
|
email_address:,
|
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.
|
@@ -315,6 +315,9 @@ module StytchB2B
|
|
315
315
|
# mfa_required::
|
316
316
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
317
317
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
318
|
+
# primary_required::
|
319
|
+
# Information about the primary authentication requirements of the Organization.
|
320
|
+
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
318
321
|
def authenticate(
|
319
322
|
organization_id:,
|
320
323
|
email_address:,
|
@@ -412,7 +415,7 @@ module StytchB2B
|
|
412
415
|
# Use a custom template for reset password emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Passwords - Reset Password.
|
413
416
|
# The type of this field is nilable +String+.
|
414
417
|
# verify_email_template_id::
|
415
|
-
# Use a custom template for verification emails sent during password reset flows.
|
418
|
+
# Use a custom template for verification emails sent during password reset flows. When cross-organization passwords are enabled for your Project, this template will be used the first time a user sets a password via a
|
416
419
|
# password reset flow. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Passwords - Email Verification.
|
417
420
|
# The type of this field is nilable +String+.
|
418
421
|
#
|
@@ -477,7 +480,7 @@ module StytchB2B
|
|
477
480
|
# The password reset token to authenticate.
|
478
481
|
# The type of this field is +String+.
|
479
482
|
# password::
|
480
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
483
|
+
# 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
484
|
# The type of this field is +String+.
|
482
485
|
# session_token::
|
483
486
|
# Reuse an existing session instead of creating a new one. If you provide a `session_token`, Stytch will update the session.
|
@@ -565,6 +568,9 @@ module StytchB2B
|
|
565
568
|
# mfa_required::
|
566
569
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
567
570
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
571
|
+
# primary_required::
|
572
|
+
# Information about the primary authentication requirements of the Organization.
|
573
|
+
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
568
574
|
def reset(
|
569
575
|
password_reset_token:,
|
570
576
|
password:,
|
@@ -656,7 +662,7 @@ module StytchB2B
|
|
656
662
|
# 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
663
|
# The type of this field is +String+.
|
658
664
|
# password::
|
659
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
665
|
+
# 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
666
|
# The type of this field is +String+.
|
661
667
|
# session_token::
|
662
668
|
# A secret token for a given Stytch Session.
|
@@ -856,6 +862,9 @@ module StytchB2B
|
|
856
862
|
# mfa_required::
|
857
863
|
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
|
858
864
|
# The type of this field is nilable +MfaRequired+ (+object+).
|
865
|
+
# primary_required::
|
866
|
+
# Information about the primary authentication requirements of the Organization.
|
867
|
+
# The type of this field is nilable +PrimaryRequired+ (+object+).
|
859
868
|
def reset(
|
860
869
|
email_address:,
|
861
870
|
existing_password:,
|
@@ -905,7 +914,7 @@ module StytchB2B
|
|
905
914
|
# The email address of the Member.
|
906
915
|
# The type of this field is +String+.
|
907
916
|
# password::
|
908
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
917
|
+
# 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
918
|
# The type of this field is +String+.
|
910
919
|
#
|
911
920
|
# == Returns:
|
@@ -996,7 +1005,7 @@ module StytchB2B
|
|
996
1005
|
#
|
997
1006
|
# The type of this field is nilable +String+.
|
998
1007
|
# verify_email_template_id::
|
999
|
-
# Use a custom template for verification emails sent during password reset flows.
|
1008
|
+
# Use a custom template for verification emails sent during password reset flows. When cross-organization passwords are enabled for your Project, this template will be used the first time a user sets a password via a
|
1000
1009
|
# password reset flow. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Passwords - Email Verification.
|
1001
1010
|
# The type of this field is nilable +String+.
|
1002
1011
|
#
|
@@ -1044,7 +1053,7 @@ module StytchB2B
|
|
1044
1053
|
# The password reset token to authenticate.
|
1045
1054
|
# The type of this field is +String+.
|
1046
1055
|
# password::
|
1047
|
-
# The password to authenticate, reset, or set for the first time. Any UTF8 character is allowed, e.g. spaces, emojis, non-English
|
1056
|
+
# 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
1057
|
# The type of this field is +String+.
|
1049
1058
|
# pkce_code_verifier::
|
1050
1059
|
# (no documentation yet)
|