@inrupt/solid-client-access-grants / fetch

Module: fetch#

Functions#

fetchWithVc#

fetchWithVc(resourceIri, accessGrant, options?): Promise<typeof fetch>

Builds a WHATWG Fetch compatible function issuing authenticated requests based on an Access Grant VC. The obtained fetch function authentication will only be valid for the resources included in the Access Grant.

Note that providing an authenticated fetch as an option is mandatory for the resulting fetch to be valid. The input fetch should be authenticated to the requestor’s Solid-OIDC provider.

Parameters#

Name

Type

Description

resourceIri

string

One of the resources from the Access Grant.

accessGrant

DatasetWithId | VerifiableCredential

The Verifiable Credential proving that the requestor has been granted access to the target resource.

options?

FetchOptions

Additional fetch options, allowing you to override the fetch() implementation

Returns#

Promise<typeof fetch>

A Promise resolving to a WHATWG Fetch compatible function matching the standard signature. The obtained fetch function will override any provided Authentication header with authentication information obtained thanks to the provided VC.

Since

0.4.0

Defined in#

src/fetch/index.ts:166