javaaws-sdkamazon-cognitologoutsingle-logout

Logout from one session on aws cognito java


How can i logout the user from only one session using aws sdk compared to using globalSignout that logouts from all active sessions?

I looked around few other questions. one of them mentioned to use AdminForgetDevice method that'll force the user to logout. but i dont know what the DeviceKey is and where do i get it from?

Admin Forget device: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminForgetDevice.html


Solution

  • Found the revoke token api: https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html

    Used this api by sending the username and the refresh token which invalidated the active session and logged out the user.