'Express-Openid-connect issues connecting to IssuerURL
I am trying to connect to Oauth provider and I am also pretty new to this.
I have an environment file with the following details
ISSUER_BASE_URL=//issuer URL
CLIENT_ID=//client ID
BASE_URL=http://localhost:3000 //nodejs project base URL
SECRET=<long string>
I also have the following code to get it working
const express = require('express');
const { auth } = require('express-openid-connect');
require('dotenv').config();
const app = express();
app.use(auth());
app.get('/', (req, res) => {
res.send(`hello ${req.oidc.user.name}`);
//res.send("index")
});
app.get('/callback', (req, res) => {
res.send("logged in");
});
app.set('trust proxy', true);
app.listen(3000, () => console.log('listening at http://localhost:3000'))
When I run this I get the following error
UnhandledPromiseRejectionWarning: AggregateError: Issuer.discover() failed.
RequestError: certificate has expired
RequestError: certificate has expired
at Function.discover (C:\nodejs_workspaces\openIdConnectTest\node_modules\openid-client\lib\issuer.js:265:17)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async pReflect (C:\nodejs_workspaces\openIdConnectTest\node_modules\p-reflect\index.js:5:17)
at async Promise.all (index 0)
at async C:\nodejs_workspaces\openIdConnectTest\node_modules\p-memoize\index.js:33:22
at async get (C:\nodejs_workspaces\openIdConnectTest\node_modules\express-openid-connect\lib\client.js:43:18)
at async pReflect (C:\nodejs_workspaces\openIdConnectTest\node_modules\p-reflect\index.js:5:17)
at async Promise.all (index 0)
at async get (C:\nodejs_workspaces\openIdConnectTest\node_modules\p-memoize\index.js:33:22)
at async ResponseContext.login (C:\nodejs_workspaces\openIdConnectTest\node_modules\express-openid-connect\lib\context.js:182:20)
With the same details, I am able to connect to the OAUTH provider using an Oauth playground. Not sure what I am doing wrong. Please help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
