即使授予aws.cognito.signin.user.admin Oauth权限,updateUserAttributes也不起作用

时间:2020-09-03 18:46:09

标签: react-native amazon-cognito

Oauth Scope

我一直在使用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));

我还检查了 app客户端设置,以获取对preferred_username属性的读写权限。 Read/Write attribute settings

仍然出现此错误:

updateUserAttributes err Object {
  "code": "NotAuthorizedException",
  "message": "Access Token does not have required scopes",
  "name": "NotAuthorizedException",
}

我也尝试了其他属性,例如website,但得到了相同的响应。

谢谢。

更新

似乎来自外部身份提供商的用户无法更新其属性here

有人可以确认或否认吗?

0 个答案:

没有答案