https://github.com/fusionauth/fusionauth-example-node-sso
Example of single sign-on with FusionAuth and node
https://github.com/fusionauth/fusionauth-example-node-sso
hacktoberfest
Last synced: 4 months ago
JSON representation
Example of single sign-on with FusionAuth and node
- Host: GitHub
- URL: https://github.com/fusionauth/fusionauth-example-node-sso
- Owner: FusionAuth
- License: apache-2.0
- Created: 2021-01-14T00:08:40.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T05:55:26.000Z (almost 2 years ago)
- Last Synced: 2025-12-17T14:43:58.699Z (6 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 130 KB
- Stars: 4
- Watchers: 9
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# FusionAuth Node.js SSO example
This project is two simple example Node.js applications that illustrates how you can easily implement single sign-on (SSO) using FusionAuth.
## Prerequisites
Docker and the ability to edit your DNS hosts.
## To run
* Create two local aliases in your DNS: `hooli.local` and `piedpiper.local`, both resolving to `127.0.0.1`.
* Run `docker compose up -d`. This will run FusionAuth and configure it using [Kickstart](https://fusionauth.io/docs/get-started/download-and-install/development/kickstart)
* Two users are created, both with the password `password.
* admin@example.com is an admin user that can log into the admin UI, located at http://localhost:9011.
* richard@example.com is a user that can log into the two application you'll start below.
* To stop FusionAuth later, run `docker compose down`
* In the `pied-piper` directory, run:
* `npm install`
* `PORT=3000 npm start`
* In the `hooli` directory, run:
* `npm install`
* `PORT=3001 npm start`
Go to `http://hooli.local:3001/` and login with `richard@example.com`. *check 'keep me signed in'*.
You should see 'Hello user'.
Then click on the 'Pied Piper' link in the menu to go to `http://piedpiper.local:3000`. You won't be prompted to sign in again, but will instead automatically be logged in.
Click 'logout' and you'll be logged out of both applications.
## Known issues
Logout only works with on hosts with valid TLS certificates due to browser limitations. If you don't have easy access to a FusionAuth instance with a valid TLS certificate, try using https://sandbox.fusionauth.io for the FusionAuth server. This is a **shared** host.
Setting up TLS certificates for local development is beyond the scope of this tutorial, but if you set up all three applications: piediper, hooli and FusionAuth with TLS, then logout will work.
## Last updated
This was last reviewed Jun 2024.