JarrymiJ
Convex Community6mo ago
66 replies
Jarrymi

Auth don't work with Next js and ConvexAuthNextjsProvider

I'm having issues with getting auth to work with the ConvexAuthNextjsProvider. All iss setup as described in https://labs.convex.dev/auth/authz/nextjs.

In the middleware.ts it seems to be working as expected (isAuthenticated is true).

But when i do await fetchAction(api.stripe.checkout, { plan: 'starter' }) and

export const checkout = action({
args: { plan: v.string() },
handler: async ({ auth }, { plan }) => {
console.log('server identity', await auth.getUserIdentity())
},
})

It just return
null
(on a clickhandler insiden react)..

I have gone trought the debugging section in the docs (https://docs.convex.dev/auth/debug)

Everything looks good, except that in the header, i don't get typ: "JWT", only "alg": "RS256"

Can you point me in the right direction?
Screenshot_2025-07-21_at_12.01.54.png
Screenshot_2025-07-21_at_12.03.47.png
Screenshot_2025-07-21_at_12.05.41.png
Troubleshoot authentication issues in Convex
Debugging Authentication | Convex Developer Hub
Was this page helpful?