I am trying to get the user attributes from cognito using AdminGetUserRequest, the following is my code:
public class getUserDetails {
public static void main(String[] args) {
String app_client_id ="xxxxxxxxxxxx";
String app_client_secret ="xxxxxxxxxxx";
String user_pool_id ="xxxxxxxxx";
String region = "xxxxxxxxxx";
String AWS_ACCESS_KEY = "xxxxxxxxxx";
String AWS_SECRET_KEY = "xxxxxxxxxx";
AWSCredentials awsCreds = new BasicAWSCredentials(AWS_ACCESS_KEY, AWS_SECRET_KEY);
AWSCognitoIdentityProvider client = AWSCognitoIdentityProviderClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.withRegion(region)
.build();
AdminGetUserRequest adminGetUserRequest = new AdminGetUserRequest()
.withUserPoolId(user_pool_id)
.withUsername("testUser");
try {
AdminGetUserResult adminGetUserResult = client.adminGetUser(adminGetUserRequest);
System.out.println(adminGetUserResult.getUserAttributes());
}catch (UserNotFoundException e) {
System.out.println("User not found");
}
}
}
The code is working fine and I am getting the user, but the attribute values are listed as Sensitive Data Redacted. The output I am getting is the following
[{Name: sub,Value: ***Sensitive Data Redacted***}, {Name: email_verified,Value: ***Sensitive Data Redacted***}, {Name: email,Value: ***Sensitive Data Redacted***}]
How do I get the values that are listed as Sensitive Data Redacted. I don't have any access tokens, I just have the username to retrieve these values.