TypeError: "issuerBaseURL" must be a valid uri

Viewed 2435

vue app will not load it keeps complaining about issuerBaseURL" must be a valid uri no matter what changes I am following this tutorial https://auth0.com/blog/complete-guide-to-nodejs-express-user-authentication/

TypeError: "issuerBaseURL" must be a valid uri
    at module.exports.get (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/node_modules/express-openid-connect/lib/config.js:200:11)
    at auth (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/node_modules/express-openid-connect/middleware/auth.js:27:18)
    at Object.<anonymous> (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/src/index.js:29:3)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47
[nodemon] app crashed - waiting for file changes before starting...




App Configuration

app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");
app.use(express.static(path.join(__dirname, "..", "public")));

app.use(
  auth({
   issuerBaseURL: process.env.AUTH0_ISSUER_BASE_URL,
   baseURL: process.env.BASE_URL,
   clientID: process.env.AUTH0_CLIENT_ID,
   secret: process.env.SESSION_SECRET,
   authRequired: false,
   auth0Logout: true,
  })
);
2 Answers

I was able to fix it by changing the .env file to AUTH0_ISSUER_BASE_URL=https://dev-4qbs9kwu.us.auth0.com/

The issuerBaseURL should be a secure URL and starts with HTTPS://

Related