RobsterR
Convex Community7mo ago
3 replies
Robster

Could not verify token claim

I've been messing around with building my own auth, but an error has happened and I'm unsure what causes it

auth.config.js:
export default {
    providers: [
        {
            type: "customJwt",
            issuer: "http://localhost:5173",
            applicationID: "convex-test",
            jwks: "http://localhost:5173/auth/jwks",
            algorithm: "RS256",
        },
    ],
};


/auth/jwks responds with:
{
  keys: [
    {
      kty: "RSA",
      alg: "RS256",
      kid: "convex-test-auth",
      use: "sig",
      n: PRIVATE_JWK_N,
      e: PRIVATE_JWK_E
    }
  ]
}


jwt:
const token = jwt.sign(payload, PRIVATE_SIGN_JWT_KEY, {
    algorithm: "RS256",
    issuer: "http://localhost:5173",
    audience: "convex-test",
    expiresIn: "2h",
    header: {
        kid: "convex-test-auth",
    }
})


This is on a local convex
Jwt with the jwk is valid.
/auth/jwks is being called
Was this page helpful?