Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

preview-token

rafaelmmiller55a4a3d7681f
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index a5aed8ff3..bfcc5ac08 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 00776e53e..ffb8ebba7 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) {