Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

api: still get mixan headers until they're completly gone

Carl-Gerhard Lindesvärd7f41e0d40b88
diff --git a/apps/api/src/utils/auth.ts b/apps/api/src/utils/auth.ts
index 825396d45..194987128 100644
--- a/apps/api/src/utils/auth.ts
+++ b/apps/api/src/utils/auth.ts
@@ -6,8 +6,13 @@ import { db } from '@openpanel/db';
export async function validateSdkRequest(
headers: RawRequestDefaultExpression['headers']
): Promise<string> {
- const clientId = headers['openpanel-client-id'] as string;
- const clientSecret = headers['openpanel-client-secret'] as string;
+ const clientIdNew = headers['openpanel-client-id'] as string;
+ const clientIdOld = headers['mixan-client-id'] as string;
+ const clientSecretNew = headers['openpanel-client-secret'] as string;
+ const clientSecretOld = headers['mixan-client-secret'] as string;
+ const clientId = clientIdNew || clientIdOld;
+ const clientSecret = clientSecretNew || clientSecretOld;
+
const origin = headers.origin;
if (!clientId) {
throw new Error('Misisng client id');