I have setup a cognito user pool with amplify and react. I now want to configure the authentication in such a way that after signin the users are redirected to pages depending on which group they are in meaning if someone from the group "admin" signsin he will be directed to a different page than someone from the group "user". Help would be very much appreciated.
Thanks alot.
Once you get the user accessToken
after logging in via Amplify Auth, you will be able to get the groups user is assigned to via accessToken.payload["cognito:groups"]
.
You can also get the user session via const session = await Auth.currentSession();
, inside you will find the accessToken
.
Based on that you will be able to redirect wherever you need.