Interface Discovery

  • All Implemented Interfaces:

    
    public interface Discovery
    
                        

    The Discovery interface provides methods for discovering a member's available organizations, creating organizations, and exchanging sessions between organizations. The Discovery product lets End Users discover and log in to Organizations they are a Member of, invited to, or eligible to join.

    Unlike our other B2B products, Discovery allows End Users to authenticate without specifying an Organization in advance. This is done via a Discovery Magic Link flow. After an End User is authenticated, an Intermediate Session is returned along with a list of associated Organizations.

    The End User can then authenticate to the desired Organization by passing the Intermediate Session and organization_id. End users can even create a new Organization instead of joining or logging in to an existing one.

    Call the StytchB2BClient.discovery.organizations() method to find a member's available organizations.

    Call the StytchB2BClient.discovery.exchangeSession() method to exchange a session between organizations.

    Call the StytchB2BClient.discovery.create() method to create a new organization.

    • Constructor Detail

    • Method Detail

      • listOrganizations

         abstract StytchResult<DiscoveredOrganizationsResponseData> listOrganizations()

        Discover a member's available organizations

        Returns:

        DiscoverOrganizationsResponse

      • listOrganizations

         abstract Unit listOrganizations(Function1<StytchResult<DiscoveredOrganizationsResponseData>, Unit> callback)

        Discover a member's available organizations

        Parameters:
        callback - a callback that receives a DiscoverOrganizationsResponse
      • exchangeIntermediateSession

         abstract StytchResult<IntermediateSessionExchangeResponseData> exchangeIntermediateSession(Discovery.SessionExchangeParameters parameters)

        Exchange an Intermediate Session for a fully realized Member Session in a desired Organization. This operation consumes the Intermediate Session. This endpoint can be used to accept invites and create new members via domain matching.

        Parameters:
        parameters - required for exchanging a session between organizations
        Returns:

        IntermediateSessionExchangeResponse

      • exchangeIntermediateSession

         abstract Unit exchangeIntermediateSession(Discovery.SessionExchangeParameters parameters, Function1<StytchResult<IntermediateSessionExchangeResponseData>, Unit> callback)

        Exchange an Intermediate Session for a fully realized Member Session in a desired Organization. This operation consumes the Intermediate Session. This endpoint can be used to accept invites and create new members via domain matching.

        Parameters:
        parameters - required for exchanging a session between organizations
        callback - a callback that receives an IntermediateSessionExchangeResponse
      • exchangeIntermediateSessionCompletable

         abstract CompletableFuture<StytchResult<IntermediateSessionExchangeResponseData>> exchangeIntermediateSessionCompletable(Discovery.SessionExchangeParameters parameters)

        Exchange an Intermediate Session for a fully realized Member Session in a desired Organization. This operation consumes the Intermediate Session. This endpoint can be used to accept invites and create new members via domain matching.

        Parameters:
        parameters - required for exchanging a session between organizations
        Returns:

        IntermediateSessionExchangeResponse

      • createOrganization

         abstract StytchResult<OrganizationCreateResponseData> createOrganization(Discovery.CreateOrganizationParameters parameters)

        Create a new organization. If an end user does not want to join any already-existing organization, or has no possible organizations to join, this endpoint can be used to create a new Organization and Member. This operation consumes the Intermediate Session. This endpoint can also be used to start an initial session for the newly created member and organization.

        Parameters:
        parameters - required for creating an organization
        Returns:

        OrganizationCreateResponse

      • createOrganization

         abstract Unit createOrganization(Discovery.CreateOrganizationParameters parameters, Function1<StytchResult<OrganizationCreateResponseData>, Unit> callback)

        Create a new organization. If an end user does not want to join any already-existing organization, or has no possible organizations to join, this endpoint can be used to create a new Organization and Member. This operation consumes the Intermediate Session. This endpoint can also be used to start an initial session for the newly created member and organization.

        Parameters:
        parameters - required for creating an organization
        callback - a callback that receives an OrganizationCreateResponse
      • createOrganizationCompletable

         abstract CompletableFuture<StytchResult<OrganizationCreateResponseData>> createOrganizationCompletable(Discovery.CreateOrganizationParameters parameters)

        Create a new organization. If an end user does not want to join any already-existing organization, or has no possible organizations to join, this endpoint can be used to create a new Organization and Member. This operation consumes the Intermediate Session. This endpoint can also be used to start an initial session for the newly created member and organization.

        Parameters:
        parameters - required for creating an organization
        Returns:

        OrganizationCreateResponse