bearB
Convex Community16mo ago
3 replies
bear

How do I authenticate a query?

I'm trying to use convex-auth in svelte, I'm retreiving the accessToken as follows, this gives me a token and a refreshToken

const tokens = await client.action(api.auth.signIn, {
            provider: 'password',
            params: {
                flow: 'signIn',
                email,
                password
            }
        });


however when trying to retrieve the current user, through const me = await client.query(api.users.currentUser, {});

for the API

export const currentUser = query({
    args: {},
    handler: async (ctx) => {
        const userId = await getAuthUserId(ctx);
        if (userId === null) {
            return null;
        }
        return await ctx.db.get(userId);
    }
});


it always returns null
Was this page helpful?