Mohan
Mohan

Reputation: 1

AWS Mobile Hub - How to get the User name

I have created a sample Android app using AWS mobile hub. Followed the Developer guide (https://docs.aws.amazon.com/aws-mobile/latest/developerguide/getting-started.html) and Added User Sign-in to Mobile App with Amazon Cognito.

Created a user and am successful in logging in. After logging in, I want to find the username with which i have logged in. These details will be sent to database to have a record on how many users have logged in.

Can any one suggest me how to fetch the username

Upvotes: 0

Views: 231

Answers (1)

Mohan
Mohan

Reputation: 1

Issue is resolved. I have used below code to get the username:
CognitoUserPool userpool = new CognitoUserPool(AuthenticatorActivity.this, new AWSConfiguration(AuthenticatorActivity.this)); String str = userpool.getCurrentUser().getUserId();

Upvotes: 0

Related Questions