Skip to content
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
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,29 @@ cd auth-user-prototype

```bash
cd backend
cp .env.sample .env
make dev
```

Then navigate to `http://localhost:3003/api/docs/index.html` for swagger.

Redis is optional. To enable it locally:
Required env vars for backend startup:

- `JWT_SECRET`
- `GOOGLE_CLIENT_ID`
- `GOOGLE_CLIENT_SECRET`

The provided `backend/.env.sample` already includes local placeholder values for these, so backend can start even if you are not testing Google OAuth.

Redis is optional. In local development it is disabled by default (`REDIS_URL=` in `.env`).
To enable Redis locally:

```bash
# example: run redis with docker
docker run --rm -p 6379:6379 redis:latest

# enable redis mode for the backend
export REDIS_URL=redis://localhost:6379/0
export REDIS_URL=redis://localhost:6379/0 # or set it in backend/.env
```

Token extension (sliding expiration) in Redis mode:
Expand Down
20 changes: 11 additions & 9 deletions backend/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
PORT=3003

# Db address
DB_ADDRESS=data/sqlite3.db
DB_ADDRESS=data/auth_service_db.sqlite

# Redis address, leave empty to disable Redis
REDIS_URL=rediss://example-redis.upstash.io
# Redis URL, keep empty to disable Redis in local development
REDIS_URL=

# JWT
JWT_SECRET=not-dev-secret
Expand All @@ -16,17 +16,19 @@ OAUTH_STATE_TOKEN_EXPIRY=300
USER_TOKEN_ABSOLUTE_EXPIRY=2592000 # 30 days

# Google OAuth
GOOGLE_CLIENT_ID=100000000-e3dsadsadsa321321.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GLUTPL-_dsa43_DSADSADSadsadsadsaC
GOOGLE_REDIRECT_URI=https://c2r5p11.hive.fi:5173/api/users/google/callback
# GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET are required by config loader.
# Use real values if you need Google OAuth; placeholder values still allow backend startup.
GOOGLE_CLIENT_ID=local-dev-google-client-id
GOOGLE_CLIENT_SECRET=local-dev-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3003/api/users/google/callback

# Frontend URL
FRONTEND_URL=https://c2r5p11.hive.fi:5173
FRONTEND_URL=http://localhost:5173

# 2FA
TWO_FA_URL_PREFIX=otpauth://totp/aaa?secret=
TWO_FA_URL_PREFIX=otpauth://totp/AuthServicePrototype?secret=

# Rate Limiter
RATE_LIMITER_DURATION_IN_SECONDS=60
RATE_LIMITER_REQUEST_LIMIT=1000
RATE_LIMITER_CLEANUP_INTERVAL_IN_SECONDS=300
RATE_LIMITER_CLEANUP_INTERVAL_IN_SECONDS=300
Loading