const { Issuer } = require('openid-client');
const express = require('express');
const session = require('express-session');
const app = express();
const port = 3000;
app.use(session({
secret: '123456',
resave: true,
saveUninitialized: true
Issuer.defaultHttpOptions = { timeout: 15000 }
const issuer = new Issuer({
issuer: process.env.APPID_ISSUER,
authorization_endpoint: process.env.APPID_AUTHORIZATION_ENDPOINT,
token_endpoint: process.env.APPID_TOKEN_ENDPOINT,
userinfo_endpoint: process.env.APPID_USERINFO_ENDPOINT,
jwks_uri: process.env.APPID_JWKS_URI,
console.log('Issuer %s %O', issuer.issuer, issuer.metadata);
issuer.defaultHttpOptions = { timeout: 15000 }
const client = new issuer.Client({
client_id: process.env.APPID_CLIENTID,
client_secret: process.env.APPID_SECRET
let authorizationUrl = client.authorizationUrl({
redirect_uri: process.env.REDIRECT_URL_CALLBACK,