Dattatray
Dattatray

Reputation: 1871

AWS Cognito : How to terminate/close user session from server

I have written a lambda function and using AdminInitiateAuthInput API in my function to authenticate the user/initiate the user session.

I am using AWS API gateway. I use the ID token received from the AdminInitiateAuthInput as the Authorization header while making API calls.

I want to terminate/logout the user, if he sends the request for logout.

Which is the API to close/terminate Cognito user session?

I came across AdminUserGlobalSignOut API, but it will terminate all the sessions for the user.

Upvotes: 0

Views: 5073

Answers (1)

Ninad Gaikwad
Ninad Gaikwad

Reputation: 4480

There isn't an API to simply sign out a user from a session as admin. You can do this using the user logout API. However if you have to implement a way to terminate user from single session you can use the AdminForgetDevice API which will effectively terminate session from that device.

Upvotes: 2

Related Questions