Could not find a declaration file for module '@kinde-oss/kinde-node-express'. 'd:/codeagain/isell-cargas-backend/node_modules/@kinde-oss/kinde-node-express/dist-cjs/index.js' implicitly has an 'any' type.
import { jwtVerify } from "@kinde-oss/kinde-node-express"; export const kindeConfig = { clientId: process.env.KINDE_CLIENT_ID, issuerBaseUrl: process.env.KINDE_DOMAIN, secret: process.env.KINDE_CLIENT_SECRET, siteUrl: "http://localhost:3000", redirectUrl: process.env.KINDE_REDIRECT_URL, }; export const verificadorKindeJWT = jwtVerify(process.env.KINDE_DOMAIN);
import { setupKinde } from "@kinde-oss/kinde-node-express" import { kindeConfig } from "./configs/autenticacion/kinde"; const app = express(); setupKinde(kindeConfig, app);
D:\codeagain\isell-cargas-backend\node_modules\@kinde-oss\kinde-node-express\dist-cjs\helpers\kindeMiddlewareHelpers.js:72 [1] const { audience } = options; [1] ^ [1] [1] TypeError: Cannot destructure property 'audience' of 'options' as it is undefined. [1] at jwtVerify (D:\codeagain\isell-cargas-backend\node_modules\@kinde-oss\kinde-node-express\dist-cjs\helpers\kindeMiddlewareHelpers.js:72:13) [1] at Object.<anonymous> (D:\codeagain\isell-cargas-backend\build\configs\autenticacion\kinde.js:21:66) [1] at Module._compile (node:internal/modules/cjs/loader:1376:14) [1] at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) [1] at Module.load (node:internal/modules/cjs/loader:1207:32) [1] at Module._load (node:internal/modules/cjs/loader:1023:12) [1] at Module.require (node:internal/modules/cjs/loader:1235:19) [1] at require (node:internal/modules/helpers:176:18) [1] at Object.<anonymous> (D:\codeagain\isell-cargas-backend\build\rutas\rutaRazonSocial.js:33:17) [1] at Module._compile (node:internal/modules/cjs/loader:1376:14)
@kinde-oss/kinde-node-express/dist-cjs/setup/kindeClient.js
with const grantTypeConfigParams = { [kinde_typescript_sdk_1.GrantType.AUTHORIZATION_CODE]: ['secret', 'redirectUrl', 'unAuthorisedUrl'], [kinde_typescript_sdk_1.GrantType.PKCE]: ['redirectUrl', 'unAuthorisedUrl'], [kinde_typescript_sdk_1.GrantType.CLIENT_CREDENTIALS]: ['secret'], };
config
const verificadorKindeJWT = jwtVerify(process.env.KINDE_DOMAIN, options);
const { jwtVerify } = require("@kinde-oss/kinde-node-express"); require("dotenv").config(); const express = require("express"); const { setupKinde, protectRoute, getUser, } = require("@kinde-oss/kinde-node-express"); const app = express(); const port = 3000; app.use(express.static("public")); const config = { clientId: process.env.KINDE_CLIENT_ID, issuerBaseUrl: process.env.KINDE_ISSUER_URL, siteUrl: process.env.KINDE_SITE_URL, secret: process.env.KINDE_CLIENT_SECRET, postLogoutRedirectUrl: process.env.KINDE_POST_LOGOUT_REDIRECT_URL, redirectUrl: process.env.KINDE_POST_LOGOUT_REDIRECT_URL, unAuthorisedUrl: process.env.KINDE_ISSUER_URL || '/unauthorized', grantType: 'AUTHORIZATION_CODE', }; const options = { audience: process.env.KINDE_ISSUER_URL || '/api' } const verificadorKindeJWT = jwtVerify(process.env.KINDE_DOMAIN, options); module.exports = { verificadorKindeJWT }; app.set("view engine", "pug"); setupKinde(config, app); app.get("/", (req, res) => { if (req.session && req.session.kindeAccessToken) { res.redirect("/admin"); } else { res.render("index", { title: "Hey", message: "Hello there! what would you like to do?", }); } }); app.get("/admin", protectRoute, getUser, (req, res) => { res.render("admin", { title: "Admin", user: req.user, }); }); app.listen(port, function () { console.log(`Kinde Express Starter Kit listening on port ${port}!`); });
"exports": { ".": { "require": { "types": "./dist-cjs/types/index.d.ts", "default": "./dist-cjs/index.js" }, "import": { "types": "./dist/types/index.d.ts", "default": "./dist/index.js" } } },
require("dotenv").config(); const { jwtVerify } = require("@kinde-oss/kinde-node-express"); const express = require("express"); const { setupKinde, protectRoute, getUser, GrantType, } = require("@kinde-oss/kinde-node-express"); const app = express(); const port = 3000; app.use(express.static("public")); const config = { grantType: GrantType.AUTHORIZATION_CODE, clientId: process.env.KINDE_CLIENT_ID, issuerBaseUrl: process.env.KINDE_ISSUER_URL, siteUrl: process.env.KINDE_SITE_URL, secret: process.env.KINDE_CLIENT_SECRET, redirectUrl: process.env.KINDE_REDIRECT_URL, unAuthorisedUrl: process.env.KINDE_SITE_URL, postLogoutRedirectUrl: process.env.KINDE_POST_LOGOUT_REDIRECT_URL, }; const options = { audience: process.env.KINDE_ISSUER_URL || '/api' } const verificadorKindeJWT = jwtVerify(process.env.KINDE_DOMAIN, options); module.exports = { verificadorKindeJWT }; app.set("view engine", "pug"); const client = setupKinde(config, app); app.get("/", async (req, res) => { if (await client.isAuthenticated(req)) { res.redirect("/admin"); } else { res.render("index", { title: "Hey", message: "Hello there! what would you like to do?", }); } }); app.get("/admin", protectRoute, getUser, (req, res) => { res.render("admin", { title: "Admin", user: req.user, }); }); app.listen(port, function () { console.log(`Listening on port ${port}!`); });
@Andre @ Kinde
if you need additional help from tomorrow onwards.