update widget token

This commit is contained in:
Alma 2025-04-09 22:56:29 +02:00
parent af7b913d9a
commit f25c9ba83d

View File

@ -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',