Skip to content

Commit a7ad3d3

Browse files
author
Kadi Kraman
committed
Better example server configuration
1 parent fae70a2 commit a7ad3d3

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

README.md

Lines changed: 33 additions & 32 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))
@@ -375,23 +376,6 @@ This library supports authenticating for Identity Server 4 out of the box. Some
375376
2. In order to revoke the access token, we must sent client id in the method body of the request.
376377
This is not part of the OAuth spec.
377378

378-
<details>
379-
<summary>Example server configuration</summary>
380-
<code>
381-
var client = new Client
382-
{
383-
ClientId = "native.code",
384-
ClientName = "Native Client (Code with PKCE)",
385-
RequireClientSecret = false,
386-
RedirectUris = { "io.identityserver.demo:/oauthredirect" },
387-
AllowedGrantTypes = GrantTypes.Code,
388-
RequirePkce = true,
389-
AllowedScopes = { "openid", "profile" },
390-
AllowOfflineAccess = true
391-
};
392-
</code>
393-
</details>
394-
395379
```js
396380
// Note "offline_access" scope is required to get a refresh token
397381
const config = {
@@ -417,26 +401,28 @@ await revoke(config, {
417401
});
418402
```
419403

404+
<details>
405+
<summary>Example server configuration</summary>
406+
<pre>
407+
var client = new Client
408+
{
409+
ClientId = "native.code",
410+
ClientName = "Native Client (Code with PKCE)",
411+
RequireClientSecret = false,
412+
RedirectUris = { "io.identityserver.demo:/oauthredirect" },
413+
AllowedGrantTypes = GrantTypes.Code,
414+
RequirePkce = true,
415+
AllowedScopes = { "openid", "profile" },
416+
AllowOfflineAccess = true
417+
};
418+
</pre>
419+
</details>
420+
420421
### Identity Server 3
421422

422423
This library supports authenticating with Identity Server 3. The only difference from
423424
Identity Server 4 is that it requires a `clientSecret` and there is no way to opt out of it.
424425

425-
<details>
426-
<summary>Example server configuration</summary>
427-
<code>
428-
var client = new Client
429-
{
430-
ClientId = "native.code",
431-
ClientName = "Native Client (Code with PKCE)",
432-
Flow = Flows.AuthorizationCodeWithProofKey,
433-
RedirectUris = { "com.your.app.name:/oauthredirect" },
434-
ClientSecrets = new List<Secret> { new Secret("secret".Sha256()) },
435-
AllowAccessToAllScopes = true,
436-
};
437-
</code>
438-
</details>
439-
440426
```js
441427
// You must include a clientSecret
442428
const config = {
@@ -463,6 +449,21 @@ await revoke(config, {
463449
});
464450
```
465451

452+
<details>
453+
<summary>Example server configuration</summary>
454+
<pre>
455+
var client = new Client
456+
{
457+
ClientId = "native.code",
458+
ClientName = "Native Client (Code with PKCE)",
459+
Flow = Flows.AuthorizationCodeWithProofKey,
460+
RedirectUris = { "com.your.app.name:/oauthredirect" },
461+
ClientSecrets = new List<Secret> { new Secret("your-client-secret".Sha256()) },
462+
AllowAccessToAllScopes = true,
463+
};
464+
</pre>
465+
</details>
466+
466467
### Google
467468

468469
Full support out of the box.

0 commit comments

Comments
 (0)