Skip to content

Commit

Permalink
Supplies a simpler token refresh method for some cases. (keycloak#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
ath88 authored Mar 29, 2021
1 parent 974b7b9 commit 73df58f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ setInterval(async () => {
}, 58 * 1000); // 58 seconds
```

In cases where you don't have a refresh token, eg. in a client credentials flow, you can simply call `kcAdminClient.auth` to get a new access token, like this:

```js
const credentials = { grantType: 'client_credentials', clientId: 'clientId', clientSecret: 'some-client-secret-uuid' };
await kcAdminClient.auth(credentials);

setInterval(() => kcAdminClient.auth(credentials), 58 * 1000); // 58 seconds
```

## Supported APIs

### [Realm admin](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_realms_admin_resource)
Expand Down

0 comments on commit 73df58f

Please sign in to comment.