Im attempting to get the User Attributes from a 3rd party user in my Cognito pool. Im able to get the User without their attributes using Auth.currentAuthenticatedUser() but there are no Attributes present on the CognitoUser object that is returned. The Documentation I have read recommends calling .getUserAttributes on that CognitoUserInstance, however, I get a 400 error whenever I attempt this.
example code:
const user = await Auth.currentAuthenticatedUser()
// console.log(user) // user is indeed a CognitoUser object.
await user.getUserAttributes((x) => {
console.log({ x });
})
// x: {
// code: "NotAuthorizedException"
// message: "Access Token does not have required scopes"
// name: "NotAuthorizedException"
// }
All of my user pool attributes currently have Read/Write permissions enabled. How do I give this users access token the required scope to grab return their own attributes?