@@ -18,6 +18,7 @@ This library _should_ support any OAuth provider that implements the
18
18
[ OAuth2 spec] ( https://tools.ietf.org/html/rfc6749#section-2.2 ) and it has been tested with:
19
19
20
20
* [ Identity Server4] ( https://demo.identityserver.io/ ) ([ Example configuration] ( #identity-server-4 ) )
21
+ * [ Identity Server3] ( https://github.com/IdentityServer/IdentityServer3 ) ([ Example configuration] ( #identity-server-3 ) )
21
22
* [ Google] ( https://developers.google.com/identity/protocols/OAuth2 )
22
23
([ Example configuration] ( #google ) )
23
24
* [ Okta] ( https://developer.okta.com ) ([ Example configuration] ( #okta ) )
@@ -400,6 +401,73 @@ await revoke(config, {
400
401
});
401
402
```
402
403
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
+
403
471
### Google
404
472
405
473
Full support out of the box.
0 commit comments