Updating users password in edge function - Auth session missing error

Hi i am trying to update my users password inside an edge function but i keep getting this error:
"message": "Auth session missing!"

I am creating the client with the users jwt:
const supabase = createClient(
    Deno.env.get("SUPABASE_URL") ?? "",
    Deno.env.get("SUPABASE_ANON_KEY") ?? "",
    {
      global: {
        headers: {
          Authorization: req.headers.get("Authorization"),
        },
      },
    }
  );


and then updating the password with:
const { data, error } = await supabase.auth.updateUser({
    password: password,
  });
Was this page helpful?