In AWS Cognito, you can add a user to a group (after first creating a group). A user may belong to one or more groups.
With using the JavaScript SDK (https://github
If you're using Amplify, if you use the currentAuthenticatedUser method you can get the groups from the response using:
response.signInUserSession.idToken.payload['cognito:groups']
Or using the currentSession method you can use either of:
response.accessToken.payload['cognito:groups']
or
response.idToken.payload['cognito:groups']