Skip to content

Commit

Permalink
feat: add OAuth client credentials option to TS client (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
kulgg authored Mar 8, 2024
1 parent cc8a867 commit 9a538fd
Show file tree
Hide file tree
Showing 11 changed files with 479 additions and 87 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
#### Minor Changes

- UIAsset: Replaced unsafe additional and private properties with safer alternative fields `customJsonAsString` (**not** affected by Json LD manipulation) and `customJsonLdAsString` (affected by Json LD manipulation), along with their private counterparts.
- API Wrapper: TS Client Library now supports OAuth Client Credentials

#### Patch Changes

Expand Down
19 changes: 18 additions & 1 deletion extensions/wrapper/clients/typescript-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can find our API Wrapper Project

## How to install

Requires a NodeJS / NPM project.
Requires global fetch API (provided by Node.js 18+ or browser).

```shell script
npm i --save @sovity.de/edc-client
Expand All @@ -34,6 +34,8 @@ npm i --save @sovity.de/edc-client

Configure your EDC Client and use endpoints of our API Wrapper Extension:

### Example Using API Key Auth

```typescript
const edcClient: EdcClient = buildEdcClient({
managementApiUrl: 'http://localhost:11002/api/management/v2',
Expand All @@ -46,6 +48,21 @@ let kpiData: KpiResult = await edcClient.useCaseApi.getKpis();
A minimal example project using the typescript API client can be found
[here](https://github.com/sovity/edc-extensions/tree/main/extensions/wrapper/clients/typescript-client-example).

### Example Using OAuth2 Client Credentials

```typescript
const edcClient: EdcClient = buildEdcClient({
managementApiUrl: 'http://localhost:11002/api/management/v2',
clientCredentials: {
tokenUrl: 'http://localhost:11002/token',
clientId: '{{your-connector}}-app',
clientSecret: '...',
},
});

let kpiData: KpiResult = await edcClient.useCaseApi.getKpis();
```

## License

Apache License 2.0 - see
Expand Down
Loading

0 comments on commit 9a538fd

Please sign in to comment.