0

Supabase authentication

by
Published Mar 16, 2023

application protected by auth using supabase, sign in using email/password or magic link and auto refresh tokens

App Supabase Authentication

The app

Static preview only: No backend
This is a static preview of the app and there is no backend. As such, the interactivity requiring script execution is non functional. To see the fully functional app, edit/run it in Windmill by clicking the button above.

Scripts used

// import * as wmill from "https://deno.land/x/[email protected]/mod.ts"

import { Resource } from "https://deno.land/x/[email protected]/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 };
}