class StytchB2B::OAuth::Discovery
def authenticate(
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.
status_code::
The type of this field is list of +String+.
All tenant IDs returned by the OAuth provider. These is typically used to identify organizations or groups within the provider's domain. For example, in HubSpot this is a Hub ID, in Slack this is the Workspace ID, and in GitHub this is an organization ID. Some OAuth providers do not return tenant IDs, some providers are guaranteed to return one, and some may return multiple. This field will always be populated if at least one tenant ID was returned from the OAuth provider and developers should prefer this field over `provider_tenant_id`.
provider_tenant_ids::
The type of this field is +String+.
The tenant ID returned by the OAuth provider. This is typically used to identify an organization or group within the provider's domain. For example, in HubSpot this is a Hub ID, in Slack this is the Workspace ID, and in GitHub this is an organization ID. This field will only be populated if exactly one tenant ID is returned from a successful OAuth authentication and developers should prefer `provider_tenant_ids` over this since it accounts for the possibility of an OAuth provider yielding multiple tenant IDs.
provider_tenant_id::
The type of this field is +String+.
Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
provider_type::
The type of this field is list of +DiscoveredOrganization+ (+object+).
c) The Organization has at least one other Member with a verified email address with the same domain as the end user (to prevent phishing attacks).
b) The Organizations' allowed domains list contains the Member's email domain.
a) The Organization allows JIT provisioning.
3. The end user can join the Organization because:
2. The end user is invited to the Organization.
1. The end user is already a Member of the Organization.
Note that Organizations will only appear here under any of the following conditions:
An array of `discovered_organization` objects tied to the `intermediate_session_token`, `session_token`, or `session_jwt`. See the [Discovered Organization Object](https://stytch.com/docs/b2b/api/discovered-organization-object) for complete details.
discovered_organizations::
The type of this field is +String+.
The email address.
email_address::
The type of this field is +String+.
The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member.
intermediate_session_token::
The type of this field is +String+.
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.
request_id::
An object with the following fields:
== Returns:
The type of this field is nilable +String+.
A base64url encoded one time secret used to validate that the request starts and ends on the same device.
pkce_code_verifier::
The type of this field is nilable +object+.
(no documentation yet)
session_custom_claims::
The type of this field is nilable +String+.
(no documentation yet)
session_jwt::
The type of this field is nilable +Integer+.
(no documentation yet)
session_duration_minutes::
The type of this field is nilable +String+.
(no documentation yet)
session_token::
The type of this field is +String+.
The Discovery OAuth token to authenticate.
discovery_oauth_token::
== Parameters:
Session Token. Intermediate Session Tokens can be used for various Discovery login flows and are valid for 10 minutes.
Authenticates the Discovery token and exchanges it for an Intermediate
def authenticate( discovery_oauth_token:, session_token: nil, session_duration_minutes: nil, session_jwt: nil, session_custom_claims: nil, pkce_code_verifier: nil ) headers = {} request = { discovery_oauth_token: discovery_oauth_token } request[:session_token] = session_token unless session_token.nil? request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil? request[:session_jwt] = session_jwt unless session_jwt.nil? request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil? request[:pkce_code_verifier] = pkce_code_verifier unless pkce_code_verifier.nil? post_request('/v1/b2b/oauth/discovery/authenticate', request, headers) end
def initialize(connection)
def initialize(connection) @connection = connection end