Skip to content

Commit

Permalink
👽 callId må være satt for oppslag mot Saf selvbetjening
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbjoern committed Jan 15, 2025
1 parent 2b96782 commit 911c529
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/services/fetchProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { requestOboToken, validateToken } from '@navikt/oasis';
import { getAccessTokenOrRedirectToLogin, logError } from '@navikt/aap-felles-utils';
import { headers } from 'next/headers';
import { randomUUID } from 'crypto';

const NUMBER_OF_RETRIES = 3;

Expand Down Expand Up @@ -40,12 +41,14 @@ export const fetchProxy = async <ResponseBody>(
};

export const fetchPdf = async (url: string, scope: string): Promise<Blob | undefined> => {
const callid = randomUUID();
const oboToken = await getOnBefalfOfToken(scope, url);
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${oboToken}`,
Accept: 'application/pdf',
'Nav-CallId': callid,
},
next: { revalidate: 0 },
});
Expand Down

0 comments on commit 911c529

Please sign in to comment.