An example application demonstrating how to use the WorkOS Node.js SDK to authenticate users via SSO.
Node.js version 10+
-
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.gitor
# SSH git clone git@github.com:workos/node-example-applications.git -
Navigate to the SSO app within the cloned repo.
cd node-example-applications/node-sso-example -
Install the dependencies.
npm install
-
Grab your API Key and Client ID from your WorkOS Dashboard. Create a
.envfile at the project root, and store them like so:WORKOS_API_KEY=sk_xxxxxxxxxxxxx WORKOS_CLIENT_ID=project_xxxxxxxxxxxx
-
Follow the SSO authentication flow instructions to create a new SSO connection in your WorkOS dashboard.
-
Add
http://localhost:8000/callbackas a Redirect URI in the Configuration section of the Dashboard. -
Update
routes/index.jswith the Organization ID.
- Start the server and head to http://localhost:8000/ to begin the login flow:
npm startIf 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.