Manage Authenticated User Sessions Via REST API Using Asgardeo React SDK

Hello everyone. In this article let’s discuss how to manage authenticated user sessions with REST API. Asgardeo Session Management API is available for
managing authenticated user sessions.

prerequisites

For this tutorial, we need to have a React application with Asgardeo Integration. You can find how to integrate Asgardeo with the existing react application from my previous article below.

API invocation can be done with httpRequst in Asgardeo Auth React SDK. with httpRequest we don’t need to retrieve tokens to invoke API endpoints because the httpRequest will send the token in the Authorization header of the request by default.

  • View all sessions for given authenticated user: GET /sessions
  • Delete a session of the authenticated user by session-id:
    DELETE /sessions/:session-id
  • Delete all the sessions of the given authenticated user:
    DELETE /sessions

As shown above, you can invoke any Session Management API endpoint with httpRequest in Asgardeo React SDK.

Sample use case of Session Management API Invocation with Asgardeo React SDK can be found here.

Session Management API Sample

If you are interested in how we can invoke SCIM2 APIs to manage authenticated user profiles using Asgardeo React SDK, you can find my article about that topic below.

Hope you have got some idea about how to invoke Asgardeo APIs with Asgardeo React SDK. You can find the full source from the working codebase below.

Cheers !!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store