【问题标题】:Implementation Issue Migrate Cognito UserPool with Lambda Trigger for iOS实施问题 Migrate Cognito UserPool with Lambda Trigger for iOS
【发布时间】:2020-11-20 08:49:51
【问题描述】:

将 AWS Cognito 旧用户池迁移到新用户池。并且还为此编写了 lambda 触发器。 Lambda 触发器似乎在 AWS Lambda 测试中工作,但在我使用 Application 登录时没有被触发。

只是为了详细描述这个问题。我有 iOS 应用程序,我已经在其中迁移了用户池,并且在阅读了一些内容后了解了需要在代码中实现的授权流程的更改。在代码中使用 ADMIN_USER_PASSWORD_AUTH 质询以获得 non_SRP 用户名和密码。无法弄清楚如何在代码的授权方法中实现它。 总之要调用用户迁移触发器如何使用 USER_PASSWORD_AUTH 进行身份验证?

func getDetails(_ authenticationInput: AWSCognitoIdentityPasswordAuthenticationInput,
                passwordAuthenticationCompletionSource: AWSTaskCompletionSource<AWSCognitoIdentityPasswordAuthenticationDetails>) {
    if currentUsername == nil || currentPassword == nil {
        return
    }

    let authDetail = AWSCognitoIdentityPasswordAuthenticationDetails.init(username: currentUsername!,
                                                                          password: currentPassword!)
    
    passwordAuthenticationCompletionSource.set(result: authDetail)
}

【问题讨论】:

    标签: ios swift amazon-web-services aws-lambda amazon-cognito


    【解决方案1】:

    经过2天的努力,我终于找到了解决方案。似乎当我们迁移 Cognito 用户池时,我们需要更改身份验证流程。默认身份验证流是 SRP 流,但这不会触发迁移。需要进行更改,但在 AWSCognitoIdentityUserPoolConfiguration 函数中需要启用 migrationEnabled 为 true。

     let userPoolConfig = AWSCognitoIdentityUserPoolConfiguration(clientId: AWSUserPoolClientId, clientSecret: AWSUserPoolClientSecret, poolId: AWSUserPoolId, shouldProvideCognitoValidationData: true, pinpointAppId: nil , migrationEnabled: true )
    

    注意:请参阅https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-dg.pdf 第 72 页了解更多详情。还有其他要记住的小事 AWS 有小错误

    AWS 文档请设置 shouldProvideCognitoValidationData: true & migrationEnabled: true 而不是在 Objective-C 中的 YES

    【讨论】:

      猜你喜欢
      • 2020-03-19
      • 2021-04-04
      • 2017-08-13
      • 2020-07-03
      • 2017-08-16
      • 2019-06-22
      • 2017-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多