Skip to content

Commit

Permalink
docs: add client credentials flow example to readme (#640)
Browse files Browse the repository at this point in the history
Co-authored-by: Aranđel Šarenac <[email protected]>
Co-authored-by: Filip Skokan <[email protected]>
  • Loading branch information
3 people authored Dec 8, 2023
1 parent c228877 commit 76db75c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ This will poll in the defined interval and only resolve with a TokenSet once one
will handle the defined `authorization_pending` and `slow_down` "soft" errors and continue polling
but upon any other error it will reject. With tokenSet received you can throw away the handle.

### Client Credentials Grant Flow

Client Credentials flow is for obtaining Access Tokens to use with third party APIs on behalf of your application, rather than an end-user which was the case in previous examples.

**See the [documentation](./docs/README.md#clientgrantbody-extras) for full API details.**

```js
const client = new issuer.Client({
client_id: 'zELcpfANLqY7Oqas',
client_secret: 'TQV5U29k1gHibH5bx1layBo0OSAvAbRT3UYW3EWrSYBB5swxjVfWUa1BS8lqzxG/0v9wruMcrGadany3',
});

const tokenSet = await client.grant({
resource: 'urn:example:third-party-api',
grant_type: 'client_credentials'
});
```

## FAQ

#### Semver?
Expand Down

0 comments on commit 76db75c

Please sign in to comment.