Skip to content

About

Shows how to use centralized sessions with FusionAuth

Resources

Security policy

Stars

1 star

Watchers

8 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

FusionAuth Node.js centralized sessions example

Warning

This repository is generated from content that lives at github.com/FusionAuth/fusionauth-site. Changes to files here will be overwritten by that automation. File an issue or pull request with fusionauth-site instead.

This project is two example Node.js applications that illustrates how you can easily implement sessions using refresh tokens to give you fine grained revocation using FusionAuth.

Prerequisites

Docker and the ability to edit your hostnames file.

To run

  • Create two local aliases in your DNS: changebank.local and changebankforum.local, both resolving to 127.0.0.1.
  • Run docker compose up -d. This will run FusionAuth and configure it using Kickstart
    • Two users are created, both with the password `password.
    • To stop FusionAuth later, run docker compose down
  • In the changebank directory, run:
    • npm install
    • npm run dev
  • In the changebankforum directory, run:
    • npm install
    • npm run dev

In an incognito window, go to http://changebank.local:8080/ and login with richard@example.com. Check 'keep me signed in'.

You'll be able to log into your ChangeBank account and make change.

Now, say you want to discuss whether nickels are better than dimes? Head over to the forum by clicking on 'Forum' in the navigation. You'll be transparently logged in.

In the non-incognito window, log into the admin UI using the credentials above. You can then navigate to Richard's account (under 'Users') and view the 'Sessions' tab, which will show you the sessions.

If you log out of ChangeBank Forum, you are only logged out of that application. If you log out of ChangeBank, the user is logged out of everything (all refresh tokens are revoked).

Learn more about Logout and Session Management in FusionAuth

Last updated

This was last reviewed Jun 2024.

About

Shows how to use centralized sessions with FusionAuth

Resources

Security policy

Stars

1 star

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages