Edits history of script submission #310 for ' Authenticate with email and password (supabase)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { createClient } from "https://esm.sh/@supabase/[email protected]";
    
    type Supabase = {
      url: string;
      key: string;
    };
    export async function main(auth: Supabase, email: string, password: string) {
      const client = createClient(auth.url, auth.key);
      const { data, error } = await client.auth.signInWithPassword({
        email,
        password,
      });
      if (error) {
        return {
          access_token: undefined,
          refresh_token: undefined,
          error: error.message,
        };
      }
      return {
        access_token: data?.session?.access_token,
        refresh_token: data?.session?.refresh_token,
        error: undefined,
      };
    }
    

    Submitted by hugo697 374 days ago

  • deno
    import { createClient } from "https://esm.sh/@supabase/[email protected]";
    
    type Supabase = {
      url: string;
      key: string;
    };
    export async function main(auth: Supabase, email: string, password: string) {
      const client = createClient(auth.url, auth.key);
      const { data, error } = await client.auth.signInWithPassword({
        email,
        password,
      });
      if (error) {
        return {
          access_token: undefined,
          refresh_token: undefined,
          error: error.message,
        };
      }
      return {
        access_token: data?.session?.access_token,
        refresh_token: data?.session?.refresh_token,
        error: undefined,
      };
    }
    

    Submitted by admin 1007 days ago

  • deno
    import { createClient } from "https://esm.sh/@supabase/[email protected]";
    
    type Supabase = {
      url: string;
      key: string;
    };
    export async function main(
      auth: Supabase,
      email: string,
      password: string,
    ) {
      const client = createClient(auth.url, auth.key);
      const { data, error } = await client.auth.signInWithPassword({email, password})
      if(error) {
        return {
          access_token: undefined,
          refresh_token: undefined,
          error: error.message
        }
      }
      return {
        access_token: data?.session?.access_token,
        refresh_token: data?.session?.refresh_token,
        error: undefined
      }
    }
    

    Submitted by admin 1010 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/[email protected]";
    
    export async function main(
      auth: Resource<"supabase">,
      email: string,
      password: string,
    ) {
      const client = createClient(auth.url, auth.key);
      const { data, error } = await client.auth.signInWithPassword({email, password})
      if(error) {
        return {
          access_token: undefined,
          refresh_token: undefined,
          error: error.message
        }
      }
      return {
        access_token: data?.session?.access_token,
        refresh_token: data?.session?.refresh_token,
        error: undefined
      }
    }
    

    Submitted by adam186 1138 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { createClient } from "https://esm.sh/@supabase/[email protected]";
    
    export async function main(
      auth: Resource<"supabase">,
      email: string,
      password: string,
    ) {
      const client = createClient(auth.url, auth.key);
      const { data, error } = await client.auth.signInWithPassword({email, password})
      if(error) {
        return {
          access_token: undefined,
          refresh_token: undefined,
          error: error.message
        }
      }
      return {
        access_token: data?.session?.access_token,
        refresh_token: data?.session?.refresh_token,
        error: undefined
      }
    }
    

    Submitted by adam186 1146 days ago