Hi,
In root app.js file I have written code like -
const { ExpressOIDC } = require(“@okta/oidc-middleware”);
let oidc = new ExpressOIDC({
issuer: process.env.ISSUER,
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
loginRedirectUri: process.env.HOST + /authorization-code/callback
,
logoutRedirectUri: process.env.HOST,
appBaseUrl: process.env.HOST,
routes: {
loginCallback: {
afterCallback: “/oklogin”
},
logout: {
// handled by this module
path: ‘/auth/logout’
},
logoutCallback: {
// handled by your application
path: ‘/auth/logout-callback’
}
},
scope: ‘openid profile email’
});
app.use(session({
secret: process.env.SECRET,
resave: true,
saveUninitialized: false
}));
app.use(oidc.router);
app.get(“/oklogin”, oidc.ensureAuthenticated(), (req, res) => {
…//writen some logic
})
app.get(‘’/auth/logout’', (req, res) => {
// Not called after logout even try with .post(‘auth/logout’,(req,res)=>{}) but this block not working
})
app.get(‘/auth/logout-callback’, (req, res) => {
// Not called after logout even try with .post(‘auth/logout-callback’,(req,res)=>{})
})
process.on(‘uncaughtException’, function (err) {
if (err) {
console.log(err);
}
});
oidc.on(“ready”, () => {
app.listen(process.env.SERVER_PORT, () => {
console.log(‘server start listenig on:’, process.env.SERVER_PORT);
})
});
oidc.on(“error”, err => {
console.error(err);
});
Set up -
Signout url - http://localhost:8080