X Tutup
Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Node.js Example App with SSO powered by WorkOS

An example application demonstrating how to use the WorkOS Node.js SDK to authenticate users via SSO.

Prerequisites

Node.js version 10+

Node.js Project Setup

  1. Clone the main repo and install dependencies for the app you'd like to use:

    # HTTPS
    git clone https://github.com/workos/node-example-applications.git

    or

    # SSH
    git clone git@github.com:workos/node-example-applications.git
  2. Navigate to the SSO app within the cloned repo.

    cd node-example-applications/node-sso-example
  3. Install the dependencies.

    npm install

Configure your environment

  1. Grab your API Key and Client ID from your WorkOS Dashboard. Create a .env file at the project root, and store them like so:

    WORKOS_API_KEY=sk_xxxxxxxxxxxxx
    WORKOS_CLIENT_ID=project_xxxxxxxxxxxx

SSO Setup with WorkOS

  1. Follow the SSO authentication flow instructions to create a new SSO connection in your WorkOS dashboard.

  2. Add http://localhost:8000/callback as a Redirect URI in the Configuration section of the Dashboard.

  3. Update routes/index.js with the Organization ID.

Testing the Integration

  1. Start the server and head to http://localhost:8000/ to begin the login flow:
npm start

Need help?

If you get stuck and aren't able to resolve the issue by reading our WorkOS Node.js SDK documentation, API reference, or tutorials, you can reach out to us at support@workos.com and we'll lend a hand.

X Tutup