Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: verify supabase token instead of google token #11

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ Backend interface for the GearFestival website.

1. Clone this repo.
2. Copy `config.local.yaml` in `config` and paste it in the same directory with `.local` removed from its name.
3. Replace `<client_id>` with your Google OAuth client id in `config.yaml`.
4. Run `go mod download` to download all the dependencies.
3. Run `go mod download` to download all the dependencies.

## Running

1. Run `supabase start` to start supabase.

> Note: You have to install [Docker](https://docs.docker.com/get-docker/) and [Supabase CLI](https://github.com/supabase/cli) before running this command.

2. Run `go run ./src/` to start server.
3. The server should be running on `localhost:8080`, `localhost:8080/swagger/index.html` for Swagger UI, and `localhost:54323/project/default/editor` for database editor.
2. Replace `<supabase_url>` and `<supabase_key>` in `config.yaml` with your Supabase API URL and anon key.
3. Run `go run ./src/` to start server.
4. The server should be running on `localhost:8080`, `localhost:8080/swagger/index.html` for Swagger UI, and `localhost:54323/project/default/editor` for database editor.

> Note: If there are no tables on the database, please run `supabase db reset` to apply migrations.

Expand Down
10 changes: 6 additions & 4 deletions config/config.local.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
supabase:
supabase_db:
host: 127.0.0.1
user: postgres
password: postgres
dbname: postgres
port: "54322"
port: 54322
sslmode: disable
sslroot: <sslroot>
schema: public
google:
client_id: <client_id>
supabase_client:
supabase_url: <supabase_url>
supabase_key: <supabase_key>
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ const docTemplate = `{
},
"securityDefinitions": {
"Bearer": {
"description": "Type \"Bearer\" followed by a space and Google ID token.",
"description": "Type \"Bearer\" followed by a space and Supabase access token.",
"type": "apiKey",
"name": "Authorization",
"in": "header"
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
},
"securityDefinitions": {
"Bearer": {
"description": "Type \"Bearer\" followed by a space and Google ID token.",
"description": "Type \"Bearer\" followed by a space and Supabase access token.",
"type": "apiKey",
"name": "Authorization",
"in": "header"
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ paths:
- user
securityDefinitions:
Bearer:
description: Type "Bearer" followed by a space and Google ID token.
description: Type "Bearer" followed by a space and Supabase access token.
in: header
name: Authorization
type: apiKey
Expand Down
23 changes: 4 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,25 @@ require (
github.com/gin-contrib/cors v1.5.0
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.5.0
github.com/nedpals/supabase-go v0.4.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.2
google.golang.org/api v0.154.0
gorm.io/driver/postgres v1.5.4
gorm.io/gorm v1.25.5
)

require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/spec v0.20.13 // indirect
Expand All @@ -38,10 +33,8 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.16.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
Expand All @@ -59,6 +52,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nedpals/postgrest-go v0.1.3 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
Expand All @@ -71,24 +65,15 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.6.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading