This is an example of a regular web application using Node.js, Express.js, midas-sso and Auth0.
This example shows how to hook up to midass-sso and perform an authorization check for the logged in user. After user signs up to midas-sso via MIDAS Accounts, the user will automatically get ISG_USER
role so that the user can access /user
. This example checks for a role of ISG_ADMIN
which user usually won't get and, if the user tries to access the /admin
route, redirects the user to the /unauthorized
.
Install the dependencies.
npm install
Copy .env.example
to .env
and replace the values for AUTH0_CLIENT_ID
, AUTH0_DOMAIN
, and AUTH0_CLIENT_SECRET
with your Auth0 credentials. If you don't yet have an MIDAS SSO account, sign up for free.
# copy configuration and replace with your own
cp .env.example .env
Run the app.
npm start
The app will be served at http://localhost:3000.
This was forked from auth0-samples/auth0-nodejs-webapp-sample and kept only 07-Authorization.