788b46a5eaee1632c88e481641de188c944233d6
How To
Authentication Setup (Ory)
Prerequisites
- Copy
.env.exampleto.envand configure:PORT=3000(your app port)TUNNEL_PORT=4000(Ory tunnel port)
Running the Application with Ory
- Start the database and services:
docker-compose up
- Apply the Ory identity migration:
docker exec -i $(docker ps -q -f name=db) psql -U party -d partydb < migrations/010_add_ory_identity_id.sql
- In one terminal, start your Go server:
go run cmd/server/main.go
- In another terminal, start the Ory tunnel:
npx @ory/cli tunnel --dev http://localhost:3000
- Access your app through the tunnel URL (typically
http://localhost:4000)
How It Works
- Users authenticate through Ory's hosted UI
- On first login, a user record is created in your database with their Ory identity ID
- Protected routes (
/profile,/api/bookings) require authentication - User context is available in handlers via
auth.GetUser(r.Context())
Amending postgres table
docker exec -i $(docker ps -q -f name=db) psql -U party -d partydb < migrations/002_add_service_image_url.sql
Entering Postgres CLI
docker exec -it $(docker ps -q -f name=db) psql -U party -d partydb
Run Ory in Docker
docker run --rm -it oryd/ory help
Description
Languages
Go
65.3%
CSS
28.9%
JavaScript
4.4%
Shell
1.4%