MAXXtremeM
Convex Community5mo ago
3 replies
MAXXtreme

Server Auth Not Working

I've followed the Convex Auth docs on how to set everything up and have also followed the Debugging Authentication docs. Everything seems to be working correctly to the end of step 3 (I have a valid JWT with "aud", "iss", and "sub" in the payload that matches my Convex site). However, calling the auth functions in my queries/mutations still return null (both in console logs and in the Convex Logs page).
// auth.ts
export const getAuth = query({
    args: {},
    handler: async (ctx) => {
        const userId = await getAuthUserId(ctx)
        const user = await ctx.auth.getUserIdentity()
        console.log('Auth', userId, user) // 'Auth', null, null
        return { userId, user }
    },
})

// auth.config.ts
export default {
    providers: [
        {
            domain: process.env.VITE_CONVEX_SITE_URL,
            applicationID: 'convex',
        },
    ],
}
Authentication library for your Convex backend
Was this page helpful?