• Express JS middleware implementing sign on for Express web apps using OpenID Connect.

    The auth() middleware requires secret, baseURL, clientID and issuerBaseURL.

    If you are using a response type that includes code, you will also need: clientSecret

    const express = require('express');
    const { auth } = require('express-openid-connect');

    const app = express();

    app.use(
    auth({
    issuerBaseURL: 'https://YOUR_DOMAIN',
    baseURL: 'https://YOUR_APPLICATION_ROOT_URL',
    clientID: 'YOUR_CLIENT_ID',
    secret: 'LONG_RANDOM_STRING',
    })
    );

    app.get('/', (req, res) => {
    res.send(`hello ${req.oidc.user.name}`);
    });

    app.listen(3000, () => console.log('listening at http://localhost:3000'))

    Parameters

    Returns RequestHandler