From 7f41e0d40b88f227286976c8e013091212cdacfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Tue, 12 Mar 2024 14:49:54 +0100 Subject: [PATCH] api: still get mixan headers until they're completly gone --- apps/api/src/utils/auth.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/api/src/utils/auth.ts b/apps/api/src/utils/auth.ts index 825396d4..19498712 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 { - 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');