Cognito User Pool allows to add user to multiple Groups.
Each group can have an IAM Role assigned. I have configured two groups: Admin (precedence: 1) and Operator (precedence: 10) . Each group has an IAM Role assignment.
I have Cognito Identity Pool configured with Cognito User Pool as an Identity Source and I have "Role from Token" selected.
In my Vue app, I have Amplify configured to use Cognito User and Identity Pools.
I can sign in with my user credentials and my app (via Amplify) is using AWS temporary credentials related to cognito:prefered_role (the one assigned to Cognito group with the lowest precedence).
I can see "cognito:groups" attribute in ID token generated by Cognito with all Groups my user is a member of, and "cognito:roles" with all IAM Roles available for this user.
The question is:
How can I switch to other roles using apmplify?