diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts index a5aed8ff..bfcc5ac0 100644 --- a/apps/api/src/controllers/auth.ts +++ b/apps/api/src/controllers/auth.ts @@ -200,7 +200,7 @@ export async function supaAuthenticateUser( let priceId: string | null = null; let chunk: AuthCreditUsageChunk | null = null; let plan: PlanType = "free"; - if (token == "this_is_just_a_preview_token") { + if (token == process.env.PREVIEW_TOKEN) { if (mode == RateLimiterMode.CrawlStatus) { rateLimiter = getRateLimiter(RateLimiterMode.CrawlStatus, token); } else if (mode == RateLimiterMode.ExtractStatus) { @@ -295,7 +295,7 @@ export async function supaAuthenticateUser( } const team_endpoint_token = - token === "this_is_just_a_preview_token" ? iptoken : teamId; + token === process.env.PREVIEW_TOKEN ? iptoken : teamId; try { await rateLimiter.consume(team_endpoint_token); @@ -325,7 +325,7 @@ export async function supaAuthenticateUser( } if ( - token === "this_is_just_a_preview_token" && + token === process.env.PREVIEW_TOKEN && (mode === RateLimiterMode.Scrape || mode === RateLimiterMode.Preview || mode === RateLimiterMode.Map || diff --git a/apps/api/src/controllers/v0/crawlPreview.ts b/apps/api/src/controllers/v0/crawlPreview.ts index 00776e53..ffb8ebba 100644 --- a/apps/api/src/controllers/v0/crawlPreview.ts +++ b/apps/api/src/controllers/v0/crawlPreview.ts @@ -24,7 +24,7 @@ export async function crawlPreviewController(req: Request, res: Response) { const incomingIP = (req.headers["x-forwarded-for"] || req.socket.remoteAddress) as string; - const iptoken = incomingIP + "this_is_just_a_preview_token"; + const iptoken = incomingIP + process.env.PREVIEW_TOKEN; const team_id = `preview_${iptoken}`; if (!auth.success) {