Quickly protecting an Express HTTP server with GitHub authentication via Auth0.
Set up an Auth0 tenant, create a web application, and then follow the Quick Start for Node.js tutorial.
After you complete the tutorial, you will get a usable
express-openid-connectconfig.The tutorial suggests you to use
authRequired: false. Change that totrue.Also add
session: { cookie: { secure: true } },to config to make sure cookie is Secure and never sent unencrypted.Allow single user by using the
claimEqualsendpoint by checking against thesub(subject) claim of the JWT:const { claimEquals } = require('express-openid-connect') app.use(claimEquals('sub', 'github|193136'))You can obtain the
subvalue by going to the Users section inside Auth0 control panel, and copy out theid.