I'm getting this error:
No auth provider found matching the given token. Check that your JWT's issuer and audience match one of your configured providers: [CustomJWT(issuer=https://api.workos
Code:
// page.tsx (Next.js)
const { accessToken } = await withAuth();
await preloadQuery(api.runs.list, {}, { token: accessToken });
// convex/runs.ts
export const list = query({
handler: async (ctx) => {
const identity = await ctx.auth.getIdentity();
return await ctx.db
.query("items")
.take(10);
},
});
// auth.config.ts
const clientId = process.env.WORKOS_CLIENT_ID;
const authConfig = {
providers: [
{
type: "customJwt",
issuer: `https://api.workos.com/`,
algorithm: "RS256",
applicationID: clientId,
jwks: `https://api.workos.com/sso/jwks/${clientId}`,
},
{
type: "customJwt",
issuer: `https://api.workos.com/user_management/${clientId}`,
algorithm: "RS256",
jwks: `https://api.workos.com/sso/jwks/${clientId}`,
applicationID: clientId,
},
],
};
export default authConfig;