我正在尝试通过ruby SDK使用 AWS Cognito 服务进行用户身份验证。
我可以使用这些方法进行注册、确认注册过程
resp = client.sign_up({ client_id: "ClientIdType",
secret_hash: "SecretHashType",
username: "UsernameType",
password: "PasswordType",
user_attributes: [{ name:"AttributeNameType",
value: "AttributeValueType",
}],
validation_data: [{
name: "AttributeNameType",
value: "AttributeValueType",
}]
})
Run Code Online (Sandbox Code Playgroud)
并使用确认注册
resp = client.confirm_sign_up({client_id: "ClientIdType",
secret_hash: "SecretHashType",
username: "UsernameType",
confirmation_code: "ConfirmationCodeType"
})
Run Code Online (Sandbox Code Playgroud)
但是,在尝试通过 initiate_auth 登录用户时,我收到错误Missing required parameter SRP_A
cog_provider.initiate_auth({client_id: "xxxxxxxxx", auth_parameters: { username: "xxx", password: "xxx"}, auth_flow: "USER_SRP_AUTH"})
Run Code Online (Sandbox Code Playgroud)
SRP_A 表示在哪里可以找到它。
我已经搜索过这个问题,建议使用admin_initiate_auth登录用户的方法,我认为这不是最佳实践。
ruby ruby-on-rails amazon-web-services srp-protocol amazon-cognito