How do I access the group for a Cognito User account?

后端 未结 7 783
情话喂你
情话喂你 2020-12-14 00:54

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

7条回答
  •  既然无缘
    2020-12-14 01:46

    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']
    

提交回复
热议问题