mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
refactor(integrations): read the OAuth redirect URIs through the env helpers
The seven integration clients now read their redirect URI and the app URL through envValue/envOr instead of a local ?.trim() ||. The empty-env guard drops its pending entry and floors its walk, and proves its matcher still fires on a real client with the old read put back.
This commit is contained in:
1 parent
903f0a9a22
commit
cc60b82d84
8 files changed
+45
-38
No files matched your search
@@ -42,6 +42,7 @@ import { safeFetch } from "@/lib/safe-fetch";
|
||||
import { canonicalDailyTimestamp } from "@/lib/measurements/consolidation-tz";
|
||||
import { zonedWallClockToUtc } from "@/lib/tz/wall-clock";
|
||||
import { FitbitApiError, classifyFitbitResponse } from "./response-classifier";
|
||||
import { envValue } from "@/lib/env";
|
||||
|
||||
/** Classic Fitbit Web API base. */
|
||||
export const FITBIT_API_BASE = "https://api.fitbit.com";
|
||||
@@ -80,8 +81,8 @@ export function getFitbitRedirectUri(): string {
|
||||
// An empty or blank value counts as unset: the compose whitelist
|
||||
// materialises an unset var as an empty string, which must fall through to
|
||||
// the derived URI rather than read as "not configured".
|
||||
const explicit = process.env.FITBIT_REDIRECT_URI?.trim() || undefined;
|
||||
const appUrl = process.env.NEXT_PUBLIC_APP_URL?.trim() || undefined;
|
||||
const explicit = envValue("FITBIT_REDIRECT_URI");
|
||||
const appUrl = envValue("NEXT_PUBLIC_APP_URL");
|
||||
const raw =
|
||||
explicit ?? (appUrl ? `${appUrl}/api/fitbit/callback` : undefined);
|
||||
|
||||
|
||||
Reference in new issue
Block a user