问题描述
我正在尝试通过AuthClass上的updateUserAttributes
方法来更新自定义(甚至是默认)属性,但是我遇到了NotAuthorizedException
错误。
我添加了两个自定义属性(plan
,stripe_id
) 之后 我创建了用户池,如果有什么不同的话
编辑:我已经使用全新的用户池和应用客户端对其进行了测试,但这仍然是一个问题。
我可以很好地注册和登录新用户,但是在尝试更新属性时会出现问题。
我进入了Cognito控制台,以设置自定义属性的写入/读取权限。
这就是我在代码中正在做的事情。
要导入AuthClass的导入语句:
import { Auth } from "aws-amplify";
this.user = await Auth.currentAuthenticatedUser();
async addAttribute() {
const attributes = new CognitoUserAttribute({
Name: "custom:plan",Value: "test",});
console.log(this.user);
console.log(attributes);
const update = Auth.updateUserAttributes(this.user,attributes).then( data=> {
console.log(data);
});
},
我尝试使用'custom'前缀(不带),并且尝试更改默认属性(地址),但所有操作都因同一错误而发生。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)