I am building a mobile application with Flutter and AWS. I am using the AWS Cognito user pool to authenticate users in the app. There are types of users in my app, which is the type USER
and ADMIN
. The Admin users are in an ADMIN user group. After the user is authenticated, I want to get the user group’s ADMIN to a different view.
How to get the user group in Flutter AWS?
2
Answers
I was able to get the user group after decoding the accessToken. The token contains
cognito:groups
attribute if the user inside a groupDocs : https://docs.amplify.aws/lib/auth/access_credentials/q/platform/flutter/
The solution is to get and decode the Jwt Token:
The output:
Thanks @Dhanuka