Skip to content

Commit

Permalink
Fiks headers og legg på credentials: include
Browse files Browse the repository at this point in the history
  • Loading branch information
almyy committed Jan 9, 2025
1 parent 95c5761 commit 95c2bac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ export async function middleware(request: NextRequest) {
}
try {
logger.info("localhost-idtoken: " + request.cookies.get("localhost-idtoken")?.value);
const headers = new Headers(request.headers);
headers.append("Authorization", `Bearer ${request.cookies.get("localhost-idtoken")?.value}`);
logger.info("headers: " + headers);
const harTilgangResponse = await fetch(process.env.NEXT_INNSYN_API_BASE_URL + "/api/v1/innsyn/tilgang", {
headers: {
...request.headers,
Authorization: `Bearer ${request.cookies.get("localhost-idtoken")?.value}`,
},
headers,
credentials: "include",
});
logger.info("harTilgangResponse. Status: " + harTilgangResponse.status);
if (harTilgangResponse.status === 401) {
Expand Down

0 comments on commit 95c2bac

Please sign in to comment.