Jerome Ansia
Jerome Ansia

Reputation: 6884

Extract username from AdminInitiateAuthResult in Amazon Cognito

Given a "refresh token" I am looking to extract the username using "AdminInitiateAuthResult" object.

Here is what my code looks like:

Map<String,String> authParams = new HashMap<String,String>();
authParams.put("REFRESH_TOKEN", refreshToken);

final AdminInitiateAuthRequest authRequest = new AdminInitiateAuthRequest().withAuthFlow(AuthFlowType.REFRESH_TOKEN).withAuthParameters(authParams).withClientId("XXXX").withUserPoolId("YYY");
final AdminInitiateAuthResult authResponse = getAWSCognitoIdentityProviderClient().adminInitiateAuth(authRequest);

Upvotes: 0

Views: 215

Answers (1)

Ionut Trestian
Ionut Trestian

Reputation: 5751

There is no username returned in the case of the refresh token flow. However, you could find the username by cracking open the tokens you retrieved.

Upvotes: 1

Related Questions