I am finding a way to get user name for Amazon Cognito users pool. I am using AWS Android Mobile SDK with AWS Mobile Hub. Created the user and logged in from my app. After logging in, how can i get the username with which i have logged in?
How to retrieve username from Amazon cognito user pool in android
1.2k Views Asked by sathis kumar At
2
There are 2 best solutions below
1
Baraseel
On
You can get user name by using this method
String getCurrentValue(){
AuthUser authUser=Amplify.Auth.getCurrentUser();
Log.e("getCurrentUser", authUser.toString());
Log.e("getCurrentUser", authUser.getUserId());
Log.e("getCurrentUser", authUser.getUsername());
return authUser.getUsername();
}
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in AMAZON-WEB-SERVICES
- S3 integration testing
- How to get content of BLOCK types LAYOUT_TITLE, LAYOUT_SECTION_HEADER and LAYOUT_xx in Textract
- Error **net::ERR_CONNECTION_RESET** error while uploading files to AWS S3 using multipart upload and Pre-Signed URL
- Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend
- AWS - Tab Schema Conversion don't show up after creating a Migration Project
- Unable to run Bash Script using AWS Custom Lambda Runtime
- Using Amazon managed Prometheus to get EC2 metrics data in Grafana
- AWS Dns record A not navigate to elb
- Connection timed out error with smtp.gmail.com
- AWS Cognito Multi-tenant Integration | Ok to use Client’s Idp?
- Elasticbeanstalk FastAPI application is intermittently not responding to https requests
- Call an External API from AWS Lambda
- Why my mail service api spring isnt working?
- export 'AWSIoTProvider' (imported as 'AWSIoTProvider') was not found in '@aws-amplify/pubsub'
- How to take first x seconds of Audio from a wav file read from AWS S3 as binary stream using Python?
Related Questions in AWS-SDK
- Why Scanning GSI on DynamoDb doesnt work as fast as expected when using CONTAINS?
- Retrieving a list of all failed Glue jobs via CLI
- Contabo Object Storage (S3) with Strapi CMS
- Buildign nestjs application with webpack and using AWS SDK v3 gives me a lot of builded folders
- Amazon Java SDK : creating connection with S3
- How do I enforce a matcher from jest when using aws-sdk-client-mock-jest?
- Unable to use type Instance from aws-sdk-v2 golang module
- PySpark job fails with missing dependencies when reading from S3 "SSLPeerUnverifiedException"
- How can I upload large image files to Wasabi more quickly in node js?
- AWS s3 getObject Command covert UTF-8 to CP932
- S3 bucket redirect object does not redirect, bus instead downloads a file
- Video streaming using AWS SDK - Second byte range call not working
- Creating cloudfront url for s3 static site from nodejs AWS-SDK
- Is this a safe way to use aws-sdk on client side?
- How to map EC2 instance to the correct product entry from the Price List Query?
Related Questions in AWS-MOBILEHUB
- Couldn't read the region / Failed to read Region from AWSConfiguration
- How to use AWS Mobile Hub with NativeScript
- Trying to initialize project with awsmobile init
- Cognito - getInstance().getTokens() Error: Failed to federate the tokens
- aws mobilehub no-sql batch update with append set
- CognitoUserPool userPool = new CognitoUserPool(this, AWSMobileClient.getInstance().getConfiguration()); is giving null value
- How to Subscribe to All GraphQL Mutations in AWS-Amplify Vue Components?
- AWS Amplify GraphQL API in Vue App Returns Null
- Is AWSmobile-cli discontinued?
- How to retrieve username from Amazon cognito user pool in android
- AWS Cognito Authentication + AWS Mobile Client + API Gateway + S3 Bucket
- Swift AWS Cognito error: Authentication delegate not set
- How to set up dev environment with AWS Mobile hub?
- AWS Cognito Identity Pool SignIn and SignOut in iOS
- AWS Amplify/CLI vs AWS mobile hub
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use the
com.amazonaws.mobile.client.AWSMobileClientto integrate with cognito user pools.AWSMobileClienthas thegetUsernamemethod that will return the signed-in user's username.See the aws-sdk-android api reference ( available at https://aws-amplify.github.io/aws-sdk-android/docs/reference/) for more information