Skip to content

Commit 76db75c

Browse files
Tobibig-kahuna-burgerpanva
authored
docs: add client credentials flow example to readme (#640)
Co-authored-by: Aranđel Šarenac <[email protected]> Co-authored-by: Filip Skokan <[email protected]>
1 parent c228877 commit 76db75c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,24 @@ This will poll in the defined interval and only resolve with a TokenSet once one
246246
will handle the defined `authorization_pending` and `slow_down` "soft" errors and continue polling
247247
but upon any other error it will reject. With tokenSet received you can throw away the handle.
248248

249+
### Client Credentials Grant Flow
250+
251+
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.
252+
253+
**See the [documentation](./docs/README.md#clientgrantbody-extras) for full API details.**
254+
255+
```js
256+
const client = new issuer.Client({
257+
client_id: 'zELcpfANLqY7Oqas',
258+
client_secret: 'TQV5U29k1gHibH5bx1layBo0OSAvAbRT3UYW3EWrSYBB5swxjVfWUa1BS8lqzxG/0v9wruMcrGadany3',
259+
});
260+
261+
const tokenSet = await client.grant({
262+
resource: 'urn:example:third-party-api',
263+
grant_type: 'client_credentials'
264+
});
265+
```
266+
249267
## FAQ
250268

251269
#### Semver?

0 commit comments

Comments
 (0)