Skip to content

Commit 3ce9c6e

Browse files
authored
Identity Server 3 documentation (#56)
* Add documentation on authenticating with Identity Server 3 * Better example server configuration
1 parent 2228b67 commit 3ce9c6e

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This library _should_ support any OAuth provider that implements the
1818
[OAuth2 spec](https://tools.ietf.org/html/rfc6749#section-2.2) and it has been tested with:
1919

2020
* [Identity Server4](https://demo.identityserver.io/) ([Example configuration](#identity-server-4))
21+
* [Identity Server3](https://github.com/IdentityServer/IdentityServer3) ([Example configuration](#identity-server-3))
2122
* [Google](https://developers.google.com/identity/protocols/OAuth2)
2223
([Example configuration](#google))
2324
* [Okta](https://developer.okta.com) ([Example configuration](#okta))
@@ -400,6 +401,73 @@ await revoke(config, {
400401
});
401402
```
402403

404+
<details>
405+
<summary>Example server configuration</summary>
406+
407+
```
408+
var client = new Client
409+
{
410+
ClientId = "native.code",
411+
ClientName = "Native Client (Code with PKCE)",
412+
RequireClientSecret = false,
413+
RedirectUris = { "io.identityserver.demo:/oauthredirect" },
414+
AllowedGrantTypes = GrantTypes.Code,
415+
RequirePkce = true,
416+
AllowedScopes = { "openid", "profile" },
417+
AllowOfflineAccess = true
418+
};
419+
```
420+
421+
</details>
422+
423+
### Identity Server 3
424+
425+
This library supports authenticating with Identity Server 3. The only difference from
426+
Identity Server 4 is that it requires a `clientSecret` and there is no way to opt out of it.
427+
428+
```js
429+
// You must include a clientSecret
430+
const config = {
431+
issuer: 'your-identityserver-url',
432+
clientId: 'your-client-id',
433+
clientSecret: 'your-client-secret',
434+
redirectUrl: 'com.your.app.name:/oauthredirect',
435+
scopes: ['openid', 'profile', 'offline_access']
436+
};
437+
438+
// Log in to get an authentication token
439+
const authState = await authorize(config);
440+
441+
// Refresh token
442+
const refreshedState = await refresh({
443+
...config,
444+
refreshToken: authState.refreshToken,
445+
});
446+
447+
// Revoke token, note that Identity Server expects a client id on revoke
448+
await revoke(config, {
449+
tokenToRevoke: refreshedState.refreshToken,
450+
sendClientId: true
451+
});
452+
```
453+
454+
<details>
455+
<summary>Example server configuration</summary>
456+
457+
```
458+
var client = new Client
459+
{
460+
ClientId = "native.code",
461+
ClientName = "Native Client (Code with PKCE)",
462+
Flow = Flows.AuthorizationCodeWithProofKey,
463+
RedirectUris = { "com.your.app.name:/oauthredirect" },
464+
ClientSecrets = new List<Secret> { new Secret("your-client-secret".Sha256()) },
465+
AllowAccessToAllScopes = true
466+
};
467+
```
468+
469+
</details>
470+
403471
### Google
404472

405473
Full support out of the box.

0 commit comments

Comments
 (0)