This document contains best practices for SAML. You should start with the quickstart first.
One of the more subtle aspects of adding SAML to your product is making it a seamless user experience. This guide will spell out your options, how to decide which one to go with, and how to implement it.
The essential challenge with adding SAML to your product’s login experience is that you need to figure out two things:
Every SAML-supporting login experience ultimately is about finding the answer to these two questions.
This document spells out exactly how to implement the three most popular user experiences for supporting “Log in with SAML”.
Or, as a flowchart / decision tree:

If you’re just looking for the easiest possible way to add “Log in with SAML” support, that’s Option 1: Explicitly ask for SAML and Organization.
This is the easiest flow to implement, at the cost of being a bit clunkier for
your customers. Your users will need to know some sort of unique identifier for
their organization inside your product, and you’ll use that identifier as the
organizationExternalId to initiate a SAML login.

Identify the page you’ll want to modify, and in particular figure out where you’d like to add a new button for “Sign in with SAML”. Typically, this goes next to any other login providers you may use, e.g. “Log in with Google”.

Add a new button that takes the user to the next step of the SAML login process
in step (3). Typically, you’ll do this by making the “Sign in with SAML” button
a link to a new /login-saml page.

On this new page, you’ll ask your user to input their organization ID.
Create a new endpoint (or GraphQL resolver, RPC method, whatever is easiest for you) on your backend. That endpoint will:
organizationExternalId argument to SSOReady.This flow gives your customers a smooth experience for logging in with SAML, while also letting you explictly offer a “Log in with SAML” button. Users explicitly opt into logging in with SAML, and you infer which company they belong to from the email they input.

Identify the page you’ll want to modify, and in particular figure out where you’d like to add a new button for “Sign in with SAML”. Typically, this goes next to any other login providers you may use, e.g. “Log in with Google”.

Add a new button that takes the user to the next step of the SAML login process
in step (3). Typically, you’ll do this by making the “Sign in with SAML” button
a link to a new /login-saml page.

On this new page, you’ll ask your user to input their email.
Create a new endpoint (or GraphQL resolver, RPC method, whatever is easiest for you) on your backend. That endpoint will:
organizationExternalId argument to SSOReady.This flow lets you avoid having a “Log in with SAML” button on the screen unless it’s appropriate. You automatically detect that SAML needs to happen while the user starts typing their email address.

Identify the page you’ll want to modify, and in particular figure out where you’d like to add a new button for “Sign in with SAML”. Typically, this goes next to any other login providers you may use, e.g. “Log in with Google”.
Create a new endpoint (or GraphQL resolver, RPC method, whatever is easiest for you) on your backend. That endpoint will:
organizationExternalId argument to SSOReady.Either on a continuous basis (e.g. every time the email input changes, maybe with debouncing) or whenever the user moves focus away from the email input, send a request to your new enpodint with the inputted email address.
Most of the time, this lookup won’t find anything, especially if the user hasn’t finished typing out the email address. In that case, don’t do anything special.

The email lookup for "jdoe@acmecorp.c" didn't find anything, so nothing special happens.
But when a lookup does succeed, then remove any password inputs or options for other kinds of login methods. Change “Log in” to “Log in with SAML”.

The email lookup for "jdoe@acmecorp.com" found an organization with SAML, so the login button becomes SAML-based.
When a user clicks “Log in with SAML”, redirect them to the URL you got back from your new lookup endpoint from step (2).
The options outlined above are the three most common ways SAML login flows are implemented by SaaS businesses.
Sometimes, customers will want special logic. Some large company is going to ask
for special logic where acmecorp.com and acmecorp.in email addresses log
into the same organization, but using a different SAML connection.
You can acquiesce to such requests, but keep in mind that you can also suggest your customer uses Identity Provider-initiated logins instead.
When you use SSOReady to implement SAML, you get support for Identity Provider-initiated flows for free. Those work by having your customer log into your product directly from their Identity Provider. For example, an Okta-initiated flow consists of clicking on a tile in their Okta with your company’s logo on it.
In most cases, you can use Service Provider-initiated flows, like the ones described on this page, to make SAML logins easy for most customers. For the occasional cases where a customer has very specific needs, they are typically used to having to implement those specific needs using an Identity Provider-initiated flow.