B2B Saas Authentication

/

Guides

/

About B2B Saas Authentication

/

Integration Approaches

/

Full-stack overview

Integrating with Stytch

Stytch is architected to be embedded directly into your application, offering you flexibility and control over your integration and creating a seamless and native experience for users.

There are three different high level approaches to integrating Stytch directly into your application:

  1. Backend Integration: entirely server-side integration, where your backend calls Stytch's API through our backend SDK
  2. Headless Frontend Integration: your client invokes Stytch's headless frontend SDKs, which handles things like client-side session management out of the box, while providing flexibility in UX and UI
  3. Pre-built UI Frontend Integration: your client mounts the Stytch UI component on relevant routes, and the Stytch SDK handles the full login flow automatically

While we describe these as distinct integration options, most customers mix-and-match approaches to fit their needs. If you are using our pre-built UI for login, you might still leverage the headless methods for post-login changes (e.g. updating profile information) and if you are using our frontend SDKs, it is important to still do server-side session authentication checks with our backend SDKs for security reasons.

Stytch offers APIs and SDKs for backend, frontend headless, and frontend pre-built UI integrations.

Choosing an integration approach

Stytch's frontend SDKs are built on top of our backend SDKs, and you can always change integration approaches in the future without any disruption to your application. Picking which approach to use to start largely comes down to how much you want to offload to Stytch vs how much flexibility and control you want.

In the below sequence diagrams outlining how Discovery OAuth Authentication and organization selection works with Stytch, you can get a sense of the differences in how you'd interact with Stytch depending on integration approach:

Discovery OAuth Sequence Diagram for Prebuilt UI Frontend IntegrationDiscovery OAuth Sequence Diagram for Headless Frontend IntegrationDiscovery OAuth Sequence Diagram for Backend Integration

Outside of the expected sequence of calls to Stytch, there are some other key differences to consider when deciding which approach is right for your use case and needs:

Differences and trade-offs of implementation methods

Relevant Resources

Frontend

Check out the SDKs reference for full documentation.

Read the guide for implementing pre-built UI components and for using our frontend SDK headlessly for more in-depth implementation details and considerations.

Backend

Read the backend implementation guide for more in-depth implementation details and considerations.

Still unsure what to choose?

If you have additional questions about our different integration options, please feel free to reach out to us in our support Slack, our developer forum, or at support@stytch.com for further guidance.