Pranay
Pranay
KKinde
Created by Pranay on 3/7/2025 in #💻┃support
jwtVerify from node express needs an audience
I am trying to set up an express server that can verify my token. This is my current code:
const express = require("express");
const { jwtVerify } = require("@kinde-oss/kinde-node-express");
const jwt = require("jsonwebtoken");
require("dotenv").config();

const app = express();
app.use(express.json());

// Environment variables from your .env file:
const KINDES_SUBDOMAIN = process.env.KINDES_SUBDOMAIN; // e.g., "your_kinde_subdomain"
const SHARED_SECRET = process.env.SHARED_SECRET; // Your HS256 secret for signing tokens
const KINDES_ISSUER = `https://${KINDES_SUBDOMAIN}.kinde.com`;

console.log("Server configuration:", {
kindeSubdomain: KINDES_SUBDOMAIN,
kindeIssuer: KINDES_ISSUER,
sharedSecretExists: !!SHARED_SECRET,
});

// Initialize the Kinde verifier middleware. This caches Kinde's JWKS.
const verifier = jwtVerify(KINDES_ISSUER);

// Token exchange endpoint: verifies the incoming Kinde token then issues a new token.
app.post("/exchange-token", verifier, (req, res) => {
console.log("Token exchange request received");
const express = require("express");
const { jwtVerify } = require("@kinde-oss/kinde-node-express");
const jwt = require("jsonwebtoken");
require("dotenv").config();

const app = express();
app.use(express.json());

// Environment variables from your .env file:
const KINDES_SUBDOMAIN = process.env.KINDES_SUBDOMAIN; // e.g., "your_kinde_subdomain"
const SHARED_SECRET = process.env.SHARED_SECRET; // Your HS256 secret for signing tokens
const KINDES_ISSUER = `https://${KINDES_SUBDOMAIN}.kinde.com`;

console.log("Server configuration:", {
kindeSubdomain: KINDES_SUBDOMAIN,
kindeIssuer: KINDES_ISSUER,
sharedSecretExists: !!SHARED_SECRET,
});

// Initialize the Kinde verifier middleware. This caches Kinde's JWKS.
const verifier = jwtVerify(KINDES_ISSUER);

// Token exchange endpoint: verifies the incoming Kinde token then issues a new token.
app.post("/exchange-token", verifier, (req, res) => {
console.log("Token exchange request received");
However I am getting an error as soon as i try to run the node server:
TypeError: Cannot destructure property 'audience' of 't' as it is undefined.
at exports.jwtVerify (/Users/pranay/Desktop/Buildspace/irl/website/tova-express/node_modules/@kinde-oss/kinde-node-express/dist/index.cjs:313:129373)
at Object.<anonymous> (/Users/pranay/Desktop/Buildspace/irl/website/tova-express/server.js:22:18)
at Module._compile (node:internal/modules/cjs/loader:1460:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at node:internal/main/run_main_module:30:49

Node.js v22.3.0
TypeError: Cannot destructure property 'audience' of 't' as it is undefined.
at exports.jwtVerify (/Users/pranay/Desktop/Buildspace/irl/website/tova-express/node_modules/@kinde-oss/kinde-node-express/dist/index.cjs:313:129373)
at Object.<anonymous> (/Users/pranay/Desktop/Buildspace/irl/website/tova-express/server.js:22:18)
at Module._compile (node:internal/modules/cjs/loader:1460:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at node:internal/main/run_main_module:30:49

Node.js v22.3.0
Is this a known issue
6 replies
KKinde
Created by Pranay on 3/6/2025 in #💻┃support
Kinde, Supabase, and React Native
Hi, I have a full NextJS app which is using supabase and kinde. I did something hacky where I never enabled RLS on the tables, but instead I checked the logged in user on every server action to make sure the user was correct and had the right permissions. Not the best approach but it worked. I am now working on making my nextJS application into a React Native app. However, seems like the hacky thing I was doing is probably not the best way forward. I'm exploring the docs but it doenst seem straightforward on integrating React Native, Kinde and Supabase. Is the main way to get around this via the JWT token? Can't find any other solutions.
7 replies
KKinde
Created by Pranay on 12/28/2024 in #💻┃support
NextJS PWA app gets stuck at this screen
No description
5 replies