-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from GenerateNU/feature/login
Fixed fiber context error
- Loading branch information
Showing
10 changed files
with
475 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"net" | ||
"strings" | ||
|
||
"github.com/GenerateNU/nightlife/internal/config" | ||
"github.com/nedpals/supabase-go" | ||
) | ||
|
||
func main() { | ||
|
||
ips, err := net.LookupIP("nydgnuqtgjljprotsccz.supabase.co") | ||
if err != nil { | ||
fmt.Printf("Failed to resolve hostname: %v\n", err) | ||
} else { | ||
fmt.Printf("Supabase IPs: %v\n", ips) | ||
} | ||
|
||
cfg, err := config.LoadConfig("../../../.env") | ||
|
||
if err != nil { | ||
log.Fatalf("Environment variables could not be loaded") | ||
} | ||
|
||
fmt.Printf("Supabase URL: %s\n", cfg.SupabaseURL) | ||
fmt.Printf("Supabase Key: %s\n", cfg.SupabaseKey) | ||
|
||
flag.Parse() | ||
|
||
args := flag.Args() | ||
if len(args) < 2 || args[0] == "" || args[1] == "" { | ||
fmt.Println(len(args)) | ||
log.Fatalf("include command line arguments correctly: \n %s", strings.Join(args, "")) | ||
} | ||
|
||
email := args[0] | ||
password := args[1] | ||
|
||
client := supabase.CreateClient(cfg.SupabaseURL, cfg.SupabaseKey) | ||
|
||
details, err := client.Auth.SignIn(context.Background(), supabase.UserCredentials{ | ||
Email: email, | ||
Password: password, | ||
Data: nil, | ||
}) | ||
|
||
if err != nil { | ||
fmt.Println(err) | ||
log.Fatalf("Sign in failed") | ||
} | ||
|
||
fmt.Printf("Access Token: %s", details.AccessToken) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
module github.com/GenerateNU/nightlife | ||
|
||
go 1.21.6 | ||
|
||
require ( | ||
github.com/gofiber/fiber/v2 v2.52.5 | ||
github.com/jackc/pgx/v4 v4.18.3 | ||
github.com/joho/godotenv v1.5.1 | ||
) | ||
|
||
require ( | ||
github.com/andybalholm/brotli v1.0.5 // indirect | ||
github.com/google/uuid v1.5.0 // indirect | ||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect | ||
github.com/jackc/pgconn v1.14.3 // indirect | ||
github.com/jackc/pgio v1.0.0 // indirect | ||
github.com/jackc/pgpassfile v1.0.0 // indirect | ||
github.com/jackc/pgproto3/v2 v2.3.3 // indirect | ||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect | ||
github.com/jackc/pgtype v1.14.0 // indirect | ||
github.com/klauspost/compress v1.17.0 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/mattn/go-runewidth v0.0.15 // indirect | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
github.com/valyala/fasthttp v1.51.0 // indirect | ||
github.com/valyala/tcplisten v1.0.0 // indirect | ||
golang.org/x/crypto v0.20.0 // indirect | ||
golang.org/x/sys v0.17.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
) | ||
module github.com/GenerateNU/nightlife | ||
|
||
go 1.21.6 | ||
|
||
require ( | ||
github.com/gofiber/fiber/v2 v2.52.5 | ||
github.com/jackc/pgx/v4 v4.18.3 | ||
github.com/joho/godotenv v1.5.1 | ||
) | ||
|
||
require ( | ||
github.com/google/go-querystring v1.1.0 // indirect | ||
github.com/nedpals/postgrest-go v0.1.3 // indirect | ||
) | ||
|
||
require ( | ||
github.com/andybalholm/brotli v1.0.5 // indirect | ||
github.com/golang-jwt/jwt/v5 v5.2.1 | ||
github.com/google/uuid v1.5.0 // indirect | ||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect | ||
github.com/jackc/pgconn v1.14.3 // indirect | ||
github.com/jackc/pgio v1.0.0 // indirect | ||
github.com/jackc/pgpassfile v1.0.0 // indirect | ||
github.com/jackc/pgproto3/v2 v2.3.3 // indirect | ||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect | ||
github.com/jackc/pgtype v1.14.0 // indirect | ||
github.com/klauspost/compress v1.17.0 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/mattn/go-runewidth v0.0.15 // indirect | ||
github.com/nedpals/supabase-go v0.4.0 | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
github.com/valyala/fasthttp v1.51.0 // indirect | ||
github.com/valyala/tcplisten v1.0.0 // indirect | ||
golang.org/x/crypto v0.20.0 // indirect | ||
golang.org/x/sys v0.17.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
) |
Oops, something went wrong.