@curity/identityserver-haapi-web-driver
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

HAAPI Web Driver

Typescript/Javascript library with classes and functions to access Curity Identity Server Hypermedia Authentication API (HAAPI) from browser-based applications. The library is available on the npm public registry and can be installed using:

npm install @curity/identityserver-haapi-web-driver

Usage example

The package defines the createHaapiFetch function, which creates fetch-like functions that can be used to perform HAAPI requests. The returned functions automatically manage attestation, access tokens, DPoP tokens, and Session-Id under the covers.

// 0 - Import the createHaapiFetch function
import { createHaapiFetch } from '@curity/identityserver-haapi-web-driver';

// 1 - Create a fetch-like function to perform HAAPI requests
const haapiFetch = createHaapiFetch({
    clientId: 'test-client-id',
    tokenEndpoint: 'https://localhost:8443/dev/oauth/token',
});

// 2 - Use haapiFetch to access HAAPI resources
const authorizeRequest = '/dev/oauth/authorize?client_id=test-client-id&response_type=code&scope=read&state=foobar&redirect_uri=https://localhost:7777/client-callback';
haapiFetch(authorizeRequest)
    .then(res => {
        // ...
    });

Package Sidebar

Install

npm i @curity/identityserver-haapi-web-driver

Weekly Downloads

1,885

Version

1.2.0

License

UNLICENSED

Unpacked Size

14.9 kB

Total Files

5

Last publish

Collaborators

  • d.lindau
  • parasjoshi24
  • surencurity
  • curity-admin
  • anestos
  • mtrojanowski
  • ideskog