0
votes

I understand there is another similar question to this one, but it does not really answer my problem as it is a little bit different. My problem is when I test and console log Auth.currentSession() in the accessToken.Payload there is no cognito:groups - So I'm wondering if there is another way of testing to see if the current authenticated user is in a group.

I've tested with a user in a group and it returns a cognito:groups attribute, whereas the user I tested without a group it does not return a cognito:groups

Thanks

Sample code:

import { Auth } from 'aws-amplify'

async checkUserGroup(){
  let payload = await Auth.currentSession()
  console.log(payload.accessToken.payload)
}