@@ -36,8 +36,8 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aw
36
36
- [ Emails] ( #emails )
37
37
- [ Lambda Triggers] ( #lambda-triggers )
38
38
- [ Import] ( #importing-user-pools )
39
- - [ App Clients] ( #app-clients )
40
39
- [ Identity Providers] ( #identity-providers )
40
+ - [ App Clients] ( #app-clients )
41
41
- [ Domains] ( #domains )
42
42
43
43
## User Pools
@@ -335,6 +335,36 @@ const otherAwesomePool = UserPool.fromUserPoolArn(stack, 'other-awesome-user-poo
335
335
' arn:aws:cognito-idp:eu-west-1:123456789012:userpool/us-east-1_mtRyYQ14D' );
336
336
```
337
337
338
+ ### Identity Providers
339
+
340
+ Users that are part of a user pool can sign in either directly through a user pool, or federate through a third-party
341
+ identity provider. Once configured, the Cognito backend will take care of integrating with the third-party provider.
342
+ Read more about [ Adding User Pool Sign-in Through a Third
343
+ Party] ( https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html ) .
344
+
345
+ The following third-party identity providers are currentlhy supported in the CDK -
346
+
347
+ * [ Login With Amazon] ( https://developer.amazon.com/apps-and-games/login-with-amazon )
348
+ * [ Facebook Login] ( https://developers.facebook.com/docs/facebook-login/ )
349
+
350
+ The following code configures a user pool to federate with the third party provider, 'Login with Amazon'. The identity
351
+ provider needs to be configured with a set of credentials that the Cognito backend can use to federate with the
352
+ third-party identity provider.
353
+
354
+ ``` ts
355
+ const userpool = new UserPool (stack , ' Pool' );
356
+
357
+ const provider = new UserPoolIdentityProviderAmazon (stack , ' Amazon' , {
358
+ clientId: ' amzn-client-id' ,
359
+ clientSecret: ' amzn-client-secret' ,
360
+ userPool: userpool ,
361
+ });
362
+ ```
363
+
364
+ In order to allow users to sign in with a third-party identity provider, the app client that faces the user should be
365
+ configured to use the identity provider. See [ App Clients] ( #app-clients ) section to know more about App Clients.
366
+ The identity providers should be configured on ` identityProviders ` property available on the ` UserPoolClient ` construct.
367
+
338
368
### App Clients
339
369
340
370
An app is an entity within a user pool that has permission to call unauthenticated APIs (APIs that do not have an
@@ -418,36 +448,22 @@ pool.addClient('app-client', {
418
448
});
419
449
```
420
450
421
- ### Identity Providers
422
-
423
- Users that are part of a user pool can sign in either directly through a user pool, or federate through a third-party
424
- identity provider. Once configured, the Cognito backend will take care of integrating with the third-party provider.
425
- Read more about [ Adding User Pool Sign-in Through a Third
426
- Party] ( https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html ) .
427
-
428
- The following third-party identity providers are currentlhy supported in the CDK -
429
-
430
- * [ Login With Amazon] ( https://developer.amazon.com/apps-and-games/login-with-amazon )
431
- * [ Facebook Login] ( https://developers.facebook.com/docs/facebook-login/ )
432
-
433
- The following code configures a user pool to federate with the third party provider, 'Login with Amazon'. The identity
434
- provider needs to be configured with a set of credentials that the Cognito backend can use to federate with the
435
- third-party identity provider.
451
+ All identity providers created in the CDK app are automatically registered into the corresponding user pool. All app
452
+ clients created in the CDK have all of the identity providers enabled by default. The 'Cognito' identity provider,
453
+ that allows users to register and sign in directly with the Cognito user pool, is also enabled by default.
454
+ Alternatively, the list of supported identity providers for a client can be explicitly specified -
436
455
437
456
``` ts
438
- const userpool = new UserPool (stack , ' Pool' );
439
-
440
- const provider = UserPoolIdentityProvider .amazon (stack , ' Amazon' , {
441
- clientId: ' amzn-client-id' ,
442
- clientSecret: ' amzn-client-secret' ,
443
- userPool: userpool ,
457
+ const pool = new UserPool (this , ' Pool' );
458
+ pool .addClient (' app-client' , {
459
+ // ...
460
+ supportedIdentityProviders: [
461
+ UserPoolClientIdentityProvider .AMAZON ,
462
+ UserPoolClientIdentityProvider .COGNITO ,
463
+ ]
444
464
});
445
465
```
446
466
447
- In order to allow users to sign in with a third-party identity provider, the app client that faces the user should be
448
- configured to use the identity provider. See [ App Clients] ( #app-clients ) section to know more about App Clients.
449
- The identity providers should be configured on ` identityProviders ` property available on the ` UserPoolClient ` construct.
450
-
451
467
### Domains
452
468
453
469
After setting up an [ app client] ( #app-clients ) , the address for the user pool's sign-up and sign-in webpages can be
0 commit comments