From f25c9ba83d0c5aa13283ba1445e7bfd809e12b8a Mon Sep 17 00:00:00 2001 From: Alma Date: Wed, 9 Apr 2025 22:56:29 +0200 Subject: [PATCH] update widget token --- app/api/rocket-chat/messages/route.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/api/rocket-chat/messages/route.ts b/app/api/rocket-chat/messages/route.ts index 60a5dd44..c26cd89c 100644 --- a/app/api/rocket-chat/messages/route.ts +++ b/app/api/rocket-chat/messages/route.ts @@ -9,16 +9,11 @@ export async function GET() { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } - // Get the access token from the session - const accessToken = session.accessToken; - if (!accessToken) { - return NextResponse.json({ error: "No access token found" }, { status: 401 }); - } - - // Use the Keycloak token to authenticate with Rocket.Chat + // Use the personal access token to authenticate with Rocket.Chat const response = await fetch('https://parole.slm-lab.net/api/v1/channels.messages', { headers: { - 'Authorization': `Bearer ${accessToken}`, + 'X-Auth-Token': 'C_3ekrsgtsaU0sVQzpJ8aRSyMQjBIvcsmXVvBI8Wmgb', + 'X-User-Id': 'Tpuww59PJKsrGNQJB', }, // Add cache control to prevent stale data cache: 'no-store',