Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function fetchWithCredentials(
session: webIdOidcSession,
fetch: Function,
input: RequestInfo,
options?: RequestOptions
): Promise {
const popToken = await PoPToken.issueFor(toUrlString(input), session)
const authenticatedOptions = {
...options,
credentials: 'include',
headers: copyHeaders(
{
authorization: `Bearer ${popToken}`
},
options
)
}
return fetch(input, authenticatedOptions)
}
async createToken(url, session) {
return PoPToken.issueFor(url, session);
}