Okta provides an API for getting the current session information for a user. This session information can be retrieved using Postman, a popular API testing and development tool. This article will provide step-by-step instructions on how to use Postman to retrieve the current session information for a user in Okta.
- Okta administrators and developers who need to retrieve the current session information for a user in their Okta org.
Prerequisites
Before beginning, please review Postman integrated with Okta.
The video below shows how to use Postman to get a user's Session ID in Okta.
Obtain the Session ID
- To retrieve the current session information with the Okta REST API, include the session ID in the request header.
- To obtain the session ID, follow the steps below.
Step 1: Obtain the Current Okta Session ID
For Okta Classic
- Log in to the Okta organization.
- Open the Chrome Developer Tools or any other browser tool that can view cookies.
- Navigate to the Application or Storage tab, depending on the browser tool.
- Find the Okta domain URL for the organization and select it.
- Look for the sid or okta-session-id cookie. This is the session ID needed for the next step.
For Okta Identity Engine (OIE)
- Log in to the Okta organization.
- Open the Developer Tools.
- Switch to the Application tab.
- Under Cookies, click on the tenant's URL.
- Click idx and copy its value.
Step 2: Add the Session ID/ idx value to Postman
- Open Postman and use the Session API Collection to find the Get Current Session request.
- In the request headers, add the following:
- Cookie in the Key column and "sid=<session ID obtained in Step 1>"/ "idx=<idx value obtained in Step 1>" in the Value column.
- Cookie in the Key column and "sid=<session ID obtained in Step 1>"/ "idx=<idx value obtained in Step 1>" in the Value column.
- Click Send to send the request.
- If successful, a response will be received with the current session information.
