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

问题描述 投票:0回答:1

我一直在使用 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
,但我得到了相同的响应。

谢谢。

更新

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

有人可以证实或否认这一点吗?

react-native amazon-cognito
1个回答
0
投票

在使用 AWS 端点更新UserAttributes 时,您是否找到了任何可行的解决方案?

我有与你相同的认知设置,并且不断遇到相同的错误:{ “代码”:“NotAuthorizedException”, "message": "访问令牌没有所需的范围", “名称”:“NotAuthorizedException”, }

https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserAttributes.html

© www.soinside.com 2019 - 2024. All rights reserved.