2026-01-12 12:47:00 +05:30
|
|
|
/**
|
|
|
|
|
* Get auth token for Electric SQL
|
|
|
|
|
* In production, this should get the token from your auth system
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export async function getElectricAuthToken(): Promise<string> {
|
|
|
|
|
// For insecure mode (development), return empty string
|
2026-01-14 02:05:40 +05:30
|
|
|
if (process.env.NEXT_PUBLIC_ELECTRIC_AUTH_MODE === "insecure") {
|
|
|
|
|
return "";
|
2026-01-12 12:47:00 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// In production, get token from your auth system
|
|
|
|
|
// This should match your backend auth token
|
2026-01-14 02:05:40 +05:30
|
|
|
if (typeof window !== "undefined") {
|
|
|
|
|
const token = localStorage.getItem("surfsense_bearer_token");
|
|
|
|
|
return token || "";
|
2026-01-12 12:47:00 +05:30
|
|
|
}
|
|
|
|
|
|
2026-01-14 02:05:40 +05:30
|
|
|
return "";
|
2026-01-12 12:47:00 +05:30
|
|
|
}
|