# Get Current Session API Not returning session

**URL:** <https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758>\
**Category:** API\
**Created:** [December 27, 2018, 6:29am UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758 "2018-12-27T06:29:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamatsa](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kamatsa](https://devforum.okta.com/u/kamatsa)\
**Post date:** [December 27, 2018, 6:29am UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/1 "2018-12-27T06:29:45Z")

</div>

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](https://dev-757208.oktapreview.com/api/v1/sessions/me)”

Can someone please help.

---

<div class="post-metadata">

**Author:** ![bretterer](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/bretterer/32/244_2.png) [@bretterer](https://devforum.okta.com/u/bretterer)\
**Post date:** [December 27, 2018, 3:41pm UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/2 "2018-12-27T15:41:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![micah.silverman](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/micah.silverman/32/1239_2.png) [@micah.silverman](https://devforum.okta.com/u/micah.silverman)\
**Post date:** [December 27, 2018, 4:31pm UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/3 "2018-12-27T16:31:29Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![kamatsa](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kamatsa](https://devforum.okta.com/u/kamatsa)\
**Post date:** [December 28, 2018, 3:48am UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/4 "2018-12-28T03:48:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rama](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rama](https://devforum.okta.com/u/rama)\
**Post date:** [July 1, 2020, 3:01pm UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/5 "2020-07-01T15:01:08Z")

</div>

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](https://devforum.okta.com/t/get-current-session-api-server-side/6787/5), 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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 24, 2024, 8:12pm UTC](https://devforum.okta.com/t/get-current-session-api-not-returning-session/3758/6 "2024-01-24T20:12:22Z")

</div>

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