【问题标题】:AWS CDK - Set IDPs to "enabled' state programmaticallyAWS CDK - 以编程方式将 IDP 设置为“启用”状态
【发布时间】:2021-02-13 09:37:29
【问题描述】:

我在我的用户池中成功创建了 Facebook 和 Google IDP,但是,它们在运行 CDK deploy 后处于“禁用”状态,我需要手动进入 UI 并单击 enabled。启用后,IDP 会按预期工作。

如何以编程方式将它们设置为enabled

this.userPool = new UserPool(this, props.userPoolId, {
  selfSignUpEnabled: true,
  autoVerify: { email: true },
  signInAliases: { email: true },
});

const googleIdp = new UserPoolIdentityProviderGoogle(
  this,
  "UserPoolIdentityProviderGoogle",
  {
    userPool: this.userPool,
    // Removed
  }
);

this.userPool.identityProviders.push(googleIdp);

const facebookIdp = new UserPoolIdentityProviderFacebook(
  this,
  "UserPoolIdentityProviderFacebook",
  {
    userPool: this.userPool,
    // Removed
  }
);

this.userPool.identityProviders.push(facebookIdp);

const userPoolClient = new UserPoolClient(this, props.userPoolClientId, {
  userPool: this.userPool,
  generateSecret: false,
  supportedIdentityProviders: [
    UserPoolClientIdentityProvider.GOOGLE,
    UserPoolClientIdentityProvider.FACEBOOK,
  ],
});

userPoolClient.node.addDependency(googleIdp, facebookIdp)

我以为我使用 UserPoolClientIdentityProvider.GOOGLEUserPoolClientIdentityProvider.FACEBOOK 行启用了这些值,但我可能错过了什么?

【问题讨论】:

    标签: typescript aws-cdk


    【解决方案1】:

    通过调整事情发生的顺序来解决:

    userPoolClient.node.addDependency(googleIdp, facebookIdp)
    
    this.userPool.identityProviders.push(googleIdp);
    this.userPool.identityProviders.push(facebookIdp);
    

    我实际上不确定为什么会这样,但我想您只需要确保 userPoolClient 具有正确的 IDP 资源,然后再将相同的 IDP 推送到 userPool

    如果有人有更好的解释,很想听听!

    【讨论】:

      猜你喜欢
      • 2018-02-17
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      • 2013-07-10
      • 2023-04-09
      • 1970-01-01
      • 2021-06-25
      • 1970-01-01
      相关资源
      最近更新 更多