# Debugging Open ID Connect NodeJS Application

**URL:** <https://devforum.okta.com/t/debugging-open-id-connect-nodejs-application/11967>\
**Category:** Questions\
**Created:** [December 3, 2020, 4:46am UTC](https://devforum.okta.com/t/debugging-open-id-connect-nodejs-application/11967 "2020-12-03T04:46:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mithunramesh19](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mithunramesh19](https://devforum.okta.com/u/mithunramesh19)\
**Post date:** [December 3, 2020, 4:46am UTC](https://devforum.okta.com/t/debugging-open-id-connect-nodejs-application/11967/1 "2020-12-03T04:46:54Z")

</div>

I am currently building a NodeJS web application (I am currently hosting this locally, but will use AWS later) but am having trouble with integrating Okta. I have attempted to use the OIDC-Okta middleware with a NodeJS app I have created. Not sure if this would be an issue, but I created an application on an organizational OKTA domain (not on the okta devs platform) and made my login redirect URI [http://localhost:3000/authorization-code/callback](http://localhost:3000/authorization-code/callback).

I followed most of the code on the OKTA github to try to run my nodeJS server: [https://github.com/okta/okta-oidc-js/tree/master/packages/oidc-middleware#upgrading](https://github.com/okta/okta-oidc-js/tree/master/packages/oidc-middleware#upgrading)

However, when running the code my server does not connect. When I comment out the oidc on or don’t use the OIDC framework, my server is loaded. I believe this might be an issue due to my OIDC config, but I have no clue because I only get a timeout error from my error messaging. How could I debug and make sure my connection/config is valid without error messaging?

If you’d like an overview of the relevant snippet of code here it is:

```
var express = require('express');
var app = express();
var port = 3000; 
app.set('view engine', 'ejs');
    const options = {
      key: fs.readFileSync('key.pem'),
      cert: fs.readFileSync('cert.pem')
    };

    const session = require("express-session");
    const { ExpressOIDC } = require("@okta/oidc-middleware");

    app.use(session({
      secret: Files.generateRandomString(25),
      resave: true,
      saveUninitialized: false
    }));

    let oidc = new ExpressOIDC({
      issuer: "https://{mydomain}/oauth2/default",
      client_id: {myclientID},
      client_secret: {mysecrettoken},
      appBaseUrl: "http://localhost:3000",
      routes:{
        loginCallback: {path: "http://localhost:3000/authorization-code/callback"},
        logoutCallback: {path: "http://localhost:3000/"}
      },
      maxClockSkew: 240,
      timeout:10000,
    });

    app.use(oidc.router);

    oidc.on('ready', () => {
      app.listen(port, function(){
        console.log('Server started at '+ new Date()+', on port ' + port+'!');
      });
    });

    oidc.on('error', err => {
      console.log("an error occured" + err);
    });
```

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 19, 2024, 12:54am UTC](https://devforum.okta.com/t/debugging-open-id-connect-nodejs-application/11967/2 "2024-01-19T00:54:41Z")

</div>

Closed on January 19, 2024, 12:54am UTC


