@@ -69,19 +69,29 @@ export const configureAdminCognitoFederation = (
69
69
pulumi . interpolate `${ userPoolDomain . output . domain } .auth.${ region } .amazoncognito.com`
70
70
) ;
71
71
72
- const providers = [ ] ;
72
+ const idpConfigs : aws . cognito . IdentityProviderArgs [ ] = [ ] ;
73
+
73
74
for ( const idp of config . identityProviders ) {
74
- providers . push (
75
- app . addResource ( aws . cognito . IdentityProvider , {
76
- name : idp . type ,
77
- config : getIdpConfig ( idp . type , userPool . output . id , idp )
78
- } )
79
- ) ;
75
+ const config = getIdpConfig ( idp . type , userPool . output . id , idp ) ;
76
+
77
+ app . addResource ( aws . cognito . IdentityProvider , {
78
+ name : config . providerName . toString ( ) ,
79
+ config
80
+ } ) ;
81
+
82
+ idpConfigs . push ( config ) ;
80
83
}
81
84
82
85
appClient . config . supportedIdentityProviders ( [
83
86
"COGNITO" ,
84
- ...providers . map ( p => p . output . providerType )
87
+ ...idpConfigs . map ( config => {
88
+ // For built-in identity providers, we use the type as the name. Only for OIDC,
89
+ // we allow the user to provide a custom name, and we only use the type as a fallback.
90
+ if ( config . providerType === "OIDC" ) {
91
+ return config . providerName ;
92
+ }
93
+ return config . providerType ;
94
+ } )
85
95
] ) ;
86
96
87
97
appClient . config . allowedOauthScopes ( [ "profile" , "email" , "openid" ] ) ;
0 commit comments