Discovery refers to a state during authentication where an end user is not yet associated with an organization and is “discovering” the organizations that they are eligible to authenticate into.
An intermediate_session_token is returned in response to any of the Discovery authenticate methods (example).A list of Discovered Organization objects is included in the response. This is a list of organizations associated with the member. This can be used to inform subsequent UI to list available organizations for the member to select from.
If only one organization is associated with the member, you can automatically start a session with that organization by calling discovery.intermediateSessions.exchange() with the organization’s ID.Similarly, if no organizations are associated with the member, you can choose to create a new organization for them to streamline your user experience.
Stytch UI provides configurations, such as directLoginForSingleMembership, to handle these scenarios out-of-the-box.
If the end user selects an organization where member_authenticated is false, you will need to trigger additional MFA or step-up authentication steps based on the authentication requirements of the selected organization.
Instead of calling the endpoints above, you can proceed directly to step-up authentication (if the primary_required value is non-null) or MFA (if the mfa_required value is non-null).