šŸ“„ next-auth/providers/workos

File: workos.md | Updated: 11/15/2025

Source: https://next-auth.js.org/providers/workos

Skip to main content

šŸŽ‰ NextAuth.js is now part of Better Auth !

Version: v4

On this page

Documentation​


https://workos.com/docs/sso/guide

Configuration​


https://dashboard.workos.com

Options​


The WorkOS Provider comes with a set of default options:

You can override any of the options to suit your own use case.

Example​


import WorkOSProvider from "next-auth/providers/workos";...providers: [  WorkOSProvider({    clientId: process.env.WORKOS_CLIENT_ID,    clientSecret: process.env.WORKOS_API_KEY,  }),],...

WorkOS is not an identity provider itself, but, rather, a bridge to multiple single sign-on (SSO) providers. As a result, we need to make some additional changes to authenticate users using WorkOS.

In order to sign a user in using WorkOS, we need to specify which WorkOS Connection to use. You should use the organization or connection authorizationParams to specify which connection to use:

import { signIn } from "next-auth/react"const organization = 'ORGANIZATION_ID';signIn(provider.id, undefined, {  organization,});

This can be done using a custom login page. See Create a Next.js application with WorkOS SSO and NextAuth.js .