Skip to content

Commit bb1f0c8

Browse files
author
Matt Raible
committed
Add Okta and Keycloak settings
1 parent bdf0085 commit bb1f0c8

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const sendClientIdOnRevoke = true;
322322
await appAuth.revokeToken(refreshedState.refreshToken, sendClientIdOnRevoke);
323323
```
324324

325-
## Google
325+
### Google
326326

327327
Full support out of the box.
328328

@@ -344,6 +344,49 @@ const refreshedState = appAuth.refresh(authState.refreshToken, scopes);
344344
await appAuth.revokeToken(refreshedState.refreshToken);
345345
```
346346

347+
### Okta
348+
349+
Full support out of the box.
350+
351+
```js
352+
const scopes = ["openid", "profile"];
353+
const appAuth = new AppAuth({
354+
issuer: 'https://{yourOktaDomain}.com/oauth2/default',
355+
clientId: '{clientId}',
356+
redirectUrl: 'com.{yourReversedOktaDomain}:/callback'
357+
});
358+
359+
// Log in to get an authentication token
360+
const authState = await appAuth.authorize(scopes);
361+
362+
// Refresh token
363+
const refreshedState = appAuth.refresh(authState.refreshToken, scopes);
364+
365+
// Revoke token
366+
await appAuth.revokeToken(refreshedState.refreshToken);
367+
```
368+
369+
### Keycloak
370+
371+
Keycloak [does not specify a revocation endpoint](http://keycloak-user.88327.x6.nabble.com/keycloak-user-Revoking-an-OAuth-Token-td3041.html) so revoke functionality doesn't work.
372+
373+
If you use [JHipster](http://www.jhipster.tech/)'s default Keycloak Docker image, everything will work with the following settings, except for revoke.
374+
375+
```js
376+
const scopes = ["openid", "profile"];
377+
const appAuth = new AppAuth({
378+
issuer: 'http://localhost:9080/auth/realms/jhipster',
379+
clientId: 'web_app',
380+
redirectUrl: '<YOUR_REDIRECT_SCHEME>:/callback'
381+
});
382+
383+
// Log in to get an authentication token
384+
const authState = await appAuth.authorize(scopes);
385+
386+
// Refresh token
387+
const refreshedState = appAuth.refresh(authState.refreshToken, scopes);
388+
```
389+
347390
## Contributors
348391

349392
Thanks goes to these wonderful people

0 commit comments

Comments
 (0)