2.2.0 • Published 7 months ago
@moreillon/express-oidc v2.2.0
Express OIDC
This is an authentication middleware that validates JWT from OIDC providers using JWKS.
Installation
npm i @moreillon/express-oidcUsage
import express, { type Request, type Response } from "express";
import authMiddleware from "@moreillon/express-oidc";
const app = express();
app.use(
authMiddleware({
jwksUri: "http://your-identity-provider/path-to-jwks",
})
);
app.get("/", (req: Request, res: Response) => {
console.log("GET /data");
console.log(res.locals.user);
res.send("Data");
});
app.listen(7070, () => {
console.log("Express listening");
});Notes
- Seems to match the content of this article
- Auth0's express-oauth2-jwt-bearer library Could be a better alternative