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
2 changes: 1 addition & 1 deletion app/oauth/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function GET(request: NextRequest) {

try {
// Determine the redirect URI (must match what was used in the authorization request)
const redirectUri = `${request.nextUrl.origin}/oauth/callback`;
const redirectUri = `${process.env.APP_BASE_URL}/oauth/callback`;

// Exchange authorization code for tokens
const tokens = await exchangeCodeForTokens(code, codeVerifier, redirectUri);
Expand Down
5 changes: 3 additions & 2 deletions app/oauth/login/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export async function GET(request: NextRequest) {
const codeVerifier = generateRandomString(64);
const codeChallenge = await generateCodeChallenge(codeVerifier);

// Determine redirect URI
const redirectUri = `${request.nextUrl.origin}/oauth/callback`;
// Determine redirect URI from the configured base URL, not the request origin,
// since the app runs behind a reverse proxy (Cloudflare Tunnel / Tailscale).
const redirectUri = `${process.env.APP_BASE_URL}/oauth/callback`;

// Store state and code verifier in cookies for validation in callback
const cookieStore = await cookies();
Expand Down
1 change: 1 addition & 0 deletions k8s/prod/configmap-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: forecasting-prod-env-config
data:
ENV: "prod"
APP_BASE_URL: "https://forecasting.ethanswan.com"
IDP_BASE_URL: "http://identity.identity-prod.svc.cluster.local"
NEXT_PUBLIC_IDP_BASE_URL: "https://identity.ethanswan.com"
SENTRY_DSN: "https://42fb7fde7d5842831f2324ed33c7f50f@o4509062063587328.ingest.us.sentry.io/4509062066012160"
1 change: 1 addition & 0 deletions k8s/staging/configmap-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: forecasting-staging-env-config
data:
ENV: "staging"
APP_BASE_URL: "https://forecasting-staging.tailc06f30.ts.net"
IDP_BASE_URL: "http://identity.identity-staging.svc.cluster.local"
NEXT_PUBLIC_IDP_BASE_URL: "https://identity-staging.tailc06f30.ts.net"
SENTRY_DSN: "https://42fb7fde7d5842831f2324ed33c7f50f@o4509062063587328.ingest.us.sentry.io/4509062066012160"
Loading