Get Current Session API Not returning session

Hello All,

I am testing the sessions REST API using curl and postman and ran into an issue with regards to retrieving the current session .
I am using the following command and am getting the resource not found error
curl -v -X GET
-H “Accept: application/json”
-H “Cookie: JSESSIONID=527194EC69CEEDC6259E7E892378EAB9; Path=/; Secure; HttpOnly”
https://dev-757208.oktapreview.com/api/v1/sessions/me

Can someone please help.

Can you show me the exact error response with all headers for this? Also, where is the JSESSIONID coming from?

You should not be using the JSESSIONID. Rather, you should be using the Okta session cookie (which if you look in your browser, would be sid.

Check these docs: https://developer.okta.com/docs/api/resources/sessions#get-current-session

NOTE: From the browser, the cookie would automatically be sent as it’s bound to the domain.

Thanks Micah & bretter. Yes I realized it later that we have to use the sid cookie.
Thanks for your prompt response in this matter.

Hi Fellows,

could I ask you please for more information how can I get the ‘sid’ cookie? I’m using the code from this answer, but I’m unable to read any cookie besides the ones available from the XmlHttpRequest.getAllResponseHeaders().
I’m trying to get this information in order to be able to use REST Client on the Server side for the Okta Session Management.

I’d greatly appreciate your answer on my question,
Many thanks and kind regards,
Rama.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.