'problem with routes with node-oidc-provider

I'm just starting with oidc-provider and I can't get express to recognize routes once I include oidc-provider.

In the simple setup below, I get a "unrecognized route on '/'. The well known url for setup does work, and the auth endpoint looks like it does as well.

const express = require('express');
const Provider = require('oidc-provider').Provider;

const app = express();

const configuration = {
  // ... see /docs for available configuration
  clients: [{
    client_id: 'foo',
    client_secret: 'bar',
    redirect_uris: ['http://192.168.128.128:3000/oidc/cb'],
    // ... other client properties
  }],
};

const oidc = new Provider('http://localhost:3000', configuration);

app.use('/oidc', oidc.callback());

app.get('/', function(req, res) {
        res.send('hello world');
});

oidc.listen(3000, () => {
  console.log('oidc-provider listening on port 3000, check http://localhost:3000/.well-known/openid-configuration');
});

I don't understand the whole "mount" notion though I suspect it has something to do with my route problem. Why is this happening? What is the solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source