update widget token
This commit is contained in:
parent
af7b913d9a
commit
f25c9ba83d
@ -9,16 +9,11 @@ export async function GET() {
|
|||||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the access token from the session
|
// Use the personal access token to authenticate with Rocket.Chat
|
||||||
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
|
|
||||||
const response = await fetch('https://parole.slm-lab.net/api/v1/channels.messages', {
|
const response = await fetch('https://parole.slm-lab.net/api/v1/channels.messages', {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${accessToken}`,
|
'X-Auth-Token': 'C_3ekrsgtsaU0sVQzpJ8aRSyMQjBIvcsmXVvBI8Wmgb',
|
||||||
|
'X-User-Id': 'Tpuww59PJKsrGNQJB',
|
||||||
},
|
},
|
||||||
// Add cache control to prevent stale data
|
// Add cache control to prevent stale data
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user