whatisagiW
Convex Community7mo ago
3 replies
whatisagi

In auth.config.ts I provided (local for

In auth.config.ts I provided (local for now)

export default {
providers: [
{
domain: "http://localhost:8787",
applicationID: "http://localhost:8787",
},
],
};

and in my route.ts I have:


function Layout() {
const convex = useConvex();

useEffect(() => {
// Set the auth fetcher function once when the layout mounts.
convex.setAuth(fetchToken);
}, [convex]);

return <Outlet />;
}

where fetchToken is just fetching the token from the local server. I verified that fetchToken is indeed called. However, when I checked with a sample mutation

export const example = mutation({
handler: async (ctx) => {
const identity = await ctx.auth.getUserIdentity();
console.log({ identity });
return true;
},
});

the identity is null.
Was this page helpful?