Amos MachoraA
Convex Community12mo ago
5 replies
Amos Machora

How to properly authenticate convex functions called via fetchAction and fetchMutation.

So in a user context I have found that you can pass the users token to object on the third arguement of a fetch action call as below

  const mythings = await fetchQuery(
    api.yadiyadiyada.getSomeX,
    {
      a: b,
    },
    { token: token }
  );

Now this is all nice and cozy but what happens if I want to authenticate a function call in a non user context. what token will i pass. In my research I have heard that I can create an api key and pass it to convex on the same field but I dont fully grasp the concept.

Thanks foryour time
Was this page helpful?