The library supports:
- Authorization using
Code
Flow. Auth0
Install with npm:
npm i --save koa-openid-client
import KoaOpenID from "koa-openid-client";
const openid = new KoaOpenID({
auth_required: true,
base_uri: "<domain>",
issuer_base_uri: "https://<domain>.auth0.com/",
scope: "openid profile email",
client_id: "<client_id>",
client_secret: "<client_secret>",
secret: "<secret_or_jwks>",
jwks: {
jwksUri: "https://<domain>.auth0.com/.well-known/jwks.json",
},
});
app.use(openid.router.routes()).use(openid.router.allowedMethods()); // use auth routes
app.use(openid.auth().unless({ path: [/^\/api\//] })); // use auth middleware