Skip to content

Commit

Permalink
chore: [AUTH-2906] Release include_refresh_token changes
Browse files Browse the repository at this point in the history
  • Loading branch information
max-stytch committed Mar 19, 2024
1 parent fa40901 commit 35248e7
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 9 deletions.
6 changes: 6 additions & 0 deletions lib/stytch/b2b_discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def initialize(connection)
# mfa_required::
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
# The type of this field is nilable +MfaRequired+ (+object+).
# primary_required::
# (no documentation yet)
# The type of this field is nilable +PrimaryRequired+ (+object+).
def exchange(
intermediate_session_token:,
organization_id:,
Expand Down Expand Up @@ -312,6 +315,9 @@ def initialize(connection)
# mfa_required::
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
# The type of this field is nilable +MfaRequired+ (+object+).
# primary_required::
# (no documentation yet)
# The type of this field is nilable +PrimaryRequired+ (+object+).
def create(
intermediate_session_token:,
organization_name:,
Expand Down
7 changes: 6 additions & 1 deletion lib/stytch/b2b_magic_links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def initialize(connection)
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
#
# The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
# intermediate_session_token::
# (no documentation yet)
# The type of this field is nilable +String+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -133,7 +136,8 @@ def authenticate(
session_jwt: nil,
session_duration_minutes: nil,
session_custom_claims: nil,
locale: nil
locale: nil,
intermediate_session_token: nil
)
headers = {}
request = {
Expand All @@ -145,6 +149,7 @@ def authenticate(
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
request[:locale] = locale unless locale.nil?
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?

post_request('/v1/b2b/magic_links/authenticate', request, headers)
end
Expand Down
10 changes: 9 additions & 1 deletion lib/stytch/b2b_oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def initialize(connection)
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
#
# The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
# intermediate_session_token::
# (no documentation yet)
# The type of this field is nilable +String+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -128,14 +131,18 @@ def initialize(connection)
# mfa_required::
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
# The type of this field is nilable +MfaRequired+ (+object+).
# primary_required::
# (no documentation yet)
# The type of this field is nilable +PrimaryRequired+ (+object+).
def authenticate(
oauth_token:,
session_token: nil,
session_duration_minutes: nil,
session_jwt: nil,
session_custom_claims: nil,
pkce_code_verifier: nil,
locale: nil
locale: nil,
intermediate_session_token: nil
)
headers = {}
request = {
Expand All @@ -147,6 +154,7 @@ def authenticate(
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
request[:pkce_code_verifier] = pkce_code_verifier unless pkce_code_verifier.nil?
request[:locale] = locale unless locale.nil?
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?

post_request('/v1/b2b/oauth/authenticate', request, headers)
end
Expand Down
30 changes: 26 additions & 4 deletions lib/stytch/b2b_organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,10 @@ def initialize(connection)
# The type of this field is nilable +String+.
# email_address::
# Updates the Member's `email_address`, if provided.
# If a Member's email address is changed, other Members in the same Organization cannot use the old email address, although the Member may update back to their old email address.
# A Member's email address can only be useable again by other Members if the Member is deleted.
#
# If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.info.email` action on the `stytch.member` Resource. Members cannot update their own email address.
# The type of this field is nilable +String+.
#
# == Returns:
Expand Down Expand Up @@ -1074,6 +1078,9 @@ def initialize(connection)
# member_id::
# 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.
# The type of this field is +String+.
# include_refresh_token::
# Whether to return the refresh token Stytch has stored for the OAuth Provider. **Important:** If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -1101,12 +1108,18 @@ def initialize(connection)
# status_code::
# 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.
# The type of this field is +Integer+.
# refresh_token::
# The `refresh_token` that you may use to obtain a new `access_token` for the User within the provider's API.
# The type of this field is nilable +String+.
def google(
organization_id:,
member_id:
member_id:,
include_refresh_token: nil
)
headers = {}
query_params = {}
query_params = {
include_refresh_token: include_refresh_token
}
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/google", query_params)
get_request(request, headers)
end
Expand All @@ -1122,6 +1135,9 @@ def google(
# member_id::
# 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.
# The type of this field is +String+.
# include_refresh_token::
# Whether to return the refresh token Stytch has stored for the OAuth Provider. **Important:** If your application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -1149,12 +1165,18 @@ def google(
# status_code::
# 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.
# The type of this field is +Integer+.
# refresh_token::
# The `refresh_token` that you may use to obtain a new `access_token` for the User within the provider's API.
# The type of this field is nilable +String+.
def microsoft(
organization_id:,
member_id:
member_id:,
include_refresh_token: nil
)
headers = {}
query_params = {}
query_params = {
include_refresh_token: include_refresh_token
}
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/members/#{member_id}/oauth_providers/microsoft", query_params)
get_request(request, headers)
end
Expand Down
14 changes: 12 additions & 2 deletions lib/stytch/b2b_passwords.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ def migrate(
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
#
# The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
# intermediate_session_token::
# (no documentation yet)
# The type of this field is nilable +String+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -305,7 +308,8 @@ def authenticate(
session_duration_minutes: nil,
session_jwt: nil,
session_custom_claims: nil,
locale: nil
locale: nil,
intermediate_session_token: nil
)
headers = {}
request = {
Expand All @@ -318,6 +322,7 @@ def authenticate(
request[:session_jwt] = session_jwt unless session_jwt.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
request[:locale] = locale unless locale.nil?
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?

post_request('/v1/b2b/passwords/authenticate', request, headers)
end
Expand Down Expand Up @@ -473,6 +478,9 @@ def reset_start(
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
#
# The type of this field is nilable +ResetRequestLocale+ (string enum).
# intermediate_session_token::
# (no documentation yet)
# The type of this field is nilable +String+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -526,7 +534,8 @@ def reset(
session_jwt: nil,
code_verifier: nil,
session_custom_claims: nil,
locale: nil
locale: nil,
intermediate_session_token: nil
)
headers = {}
request = {
Expand All @@ -539,6 +548,7 @@ def reset(
request[:code_verifier] = code_verifier unless code_verifier.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
request[:locale] = locale unless locale.nil?
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?

post_request('/v1/b2b/passwords/email/reset', request, headers)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/stytch/b2b_sessions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def revoke(
# To create a new member via domain matching, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
#
# Only Email Magic Link, OAuth, and SMS OTP factors can be transferred between sessions. Other authentication factors, such as password factors, will not be transferred to the new session.
# Any OAuth Tokens owned by the Member will not be transferred to the new Organization.
# SMS OTP factors can be used to fulfill MFA requirements for the target Organization if both the original and target Member have the same phone number and the phone number is verified for both Members.
#
# 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.
Expand Down Expand Up @@ -295,6 +296,9 @@ def revoke(
# mfa_required::
# Information about the MFA requirements of the Organization and the Member's options for fulfilling MFA.
# The type of this field is nilable +MfaRequired+ (+object+).
# primary_required::
# (no documentation yet)
# The type of this field is nilable +PrimaryRequired+ (+object+).
def exchange(
organization_id:,
session_token: nil,
Expand Down
7 changes: 6 additions & 1 deletion lib/stytch/b2b_sso.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def delete_connection(
# Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
#
# The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
# intermediate_session_token::
# (no documentation yet)
# The type of this field is nilable +String+.
#
# == Returns:
# An object with the following fields:
Expand Down Expand Up @@ -234,7 +237,8 @@ def authenticate(
session_jwt: nil,
session_duration_minutes: nil,
session_custom_claims: nil,
locale: nil
locale: nil,
intermediate_session_token: nil
)
headers = {}
request = {
Expand All @@ -246,6 +250,7 @@ def authenticate(
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
request[:locale] = locale unless locale.nil?
request[:intermediate_session_token] = intermediate_session_token unless intermediate_session_token.nil?

post_request('/v1/b2b/sso/authenticate', request, headers)
end
Expand Down

0 comments on commit 35248e7

Please sign in to comment.