我一直在使用 AWS cognito 并尝试更新
preferred_username
属性。
我尝试拨打
Auth.updateUserAttributes
电话但没有成功。
这是完整的代码:
Auth.updateUserAttributes(user, {
preferred_username: "new_username",
})
.then((data) => {
setUser(data);
console.log("updateUserAttributes succ", data);
})
.catch((error) => {
console.log("updateUserAttributes err", error);
});
})
.catch((r) => console.log("getUser err", r));
我还检查了应用程序客户端设置对
preferred_username
属性的读/写权限。
我仍然收到此错误:
updateUserAttributes err Object {
"code": "NotAuthorizedException",
"message": "Access Token does not have required scopes",
"name": "NotAuthorizedException",
}
我也尝试了其他属性,例如
website
,但我得到了相同的响应。
谢谢。
来自外部身份提供商的用户似乎无法更新其属性此处。
有人可以证实或否认这一点吗?
在使用 AWS 端点更新UserAttributes 时,您是否找到了任何可行的解决方案?
我有与你相同的认知设置,并且不断遇到相同的错误:{ “代码”:“NotAuthorizedException”, "message": "访问令牌没有所需的范围", “名称”:“NotAuthorizedException”, }