application protected by auth using supabase, sign in using email/password or magic link and auto refresh tokens
// import * as wmill from "https://deno.land/x/windmill@v1.77.0/mod.ts"
import { Resource } from "https://deno.land/x/windmill@v1.77.0/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
export async function main(
auth: Resource<"supabase">,
access_token: string,
refresh_token: string,
) {
const supabase = createClient(auth.url, auth.key, {
global: { headers: { Authorization: `bearer ${access_token}` } },
});
const { data, error } = await supabase.from("profiles").select();
return { data, error };
}