相关疑难解决方法(0)

AWS Cognito:如何允许用户在不发送验证码的情况下更改电子邮件?

在我的 Android 应用程序中,我希望我的用户能够更改他们的电子邮件地址(他们用来连接到他们的帐户),而无需通过电子邮件获取任何验证码。

到目前为止,我设法更改了电子邮件地址,感谢 lambda,设置email_verifiedtrue自动。但不幸的是,仍然发送了一封带有验证码的电子邮件......

这是我在我的 Android 应用程序中所做的:

public void onClickChangeEmail(View view)
{
    CognitoUserAttributes attributes = new CognitoUserAttributes();
    attributes.getAttributes().put("email", "second@mail.com");
    CognitoSettings
            .getCognitoUserPool(MainActivity.this)
            .getCurrentUser()
            .updateAttributesInBackground(attributes, new UpdateAttributesHandler()
    {
        @Override
        public void onSuccess(List<CognitoUserCodeDeliveryDetails> attributesVerificationList)
        {
            Log.i("tag", "Email updated!");
        }

        @Override
        public void onFailure(Exception e)
        {
            e.printStackTrace();
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

在我的 AWS 控制台中,我在 Cognito 中的Custom message上添加了一个触发器,这是我的 lambda 函数,每次用户更新他的电子邮件时都会触发它:

const AWS = require('aws-sdk')
AWS.config.update({region: 'eu-central-1'});

exports.handler = (event, context, callback) => {
    if (event.triggerSource === 'CustomMessage_UpdateUserAttribute')
    {
        const …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cognito

9
推荐指数
1
解决办法
1930
查看次数