1 | import { createClient } from "https://esm.sh/@supabase/[email protected]"; |
2 |
|
3 | type Supabase = { |
4 | url: string; |
5 | key: string; |
6 | }; |
7 | export async function main(auth: Supabase, email: string, password: string) { |
8 | const client = createClient(auth.url, auth.key); |
9 | const { data, error } = await client.auth.signInWithPassword({ |
10 | email, |
11 | password, |
12 | }); |
13 | if (error) { |
14 | return { |
15 | access_token: undefined, |
16 | refresh_token: undefined, |
17 | error: error.message, |
18 | }; |
19 | } |
20 | return { |
21 | access_token: data?.session?.access_token, |
22 | refresh_token: data?.session?.refresh_token, |
23 | error: undefined, |
24 | }; |
25 | } |
26 |
|