Clerk-SSO-Starter

This is a starter repository about how to use Clerk.dev to enforce SSO across multiple SPAs and APIs.

Architecture

architecture

The repo contains two ExpressJS APIs and two SPAs bootstrapped with CRA. Each SPA is using both APIs to fetch data.

Start the APIs

cd backend

npm i

npm run start:jazz
npm run start:rock

Start the SPAs

Jazz SPA

cd frontend/jazz

npm i

npm start

Rock SPA

cd frontend/rock

npm i

npm start

SSO & SLO

  1. Go to localhost:3000 (Jazz SPA)
  2. Sign up or sign in with a user
  3. Notice that both API requests are authenticated
  4. Go to localhost:3001 (Rock SPA)
  5. Notice that you are automatically signed in with the user from step 2
  6. Sign out
  7. Notice that both SPAs sign out (SLO)