【发布时间】:2019-12-29 18:47:38
【问题描述】:
我在登录时或更新用户属性后无法从 AWS Cognito 获取最新用户信息。
我正在使用 aws-amplify 进行身份验证,并且注册和登录工作正常。
问题出现在我的个人资料页面上。我允许人们注册通知以及更改他们个人资料中的其他数据。我已通过记录响应验证了更改已在后端以及控制台中成功进行。
但是,当我调用 Auth.currentAuthenticatedUser() 时,我得到了之前缓存的信息。
收到成功响应后如何检索更新的用户属性?
async () => {
const { email, given_name, family_name, preferred_username, "custom:notifyPredictRemind": customNotifyPredictRemind, "custom:notifyPredictResult": customNotifyPredictResult } = this.state;
let params = { email, given_name, family_name, preferred_username, "custom:notifyPredictRemind": customNotifyPredictRemind, "custom:notifyPredictResult": customNotifyPredictResult }
let updateResult = await Auth.updateUserAttributes(user, params) // returns SUCCESS
let user = await Auth.currentAuthenticaterUser()
}
我希望最后调用 currentAuthenticaterUser 以返回更新的用户信息。任何想法我该怎么做?谢谢。
【问题讨论】:
标签: react-native amazon-cognito aws-amplify