<p>Trying to debug an issue where in a dev environment logging into the cp it doesn't set the CP Authentication Cookie (the hash with the _identity) at the end of it. I believe this is the root cause of why no entries load and any request to the craft api returns a 400 with a response of Forbidden: Login Required.</p>

<p>This is the weird part because I am able to log in initially but after doing so it is as if i'm not logged in and I can only see a few things. </p>

<p>The other thing that happens is after a minute the session expired modal will pop up and after entering my pw again the modal won't go away. Now if I check my cookies I'll see the authentication cookie but it seems to automatically expire after it get set.</p>

<p><a href="https://i.sstatic.net/Az8uA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Az8uA.png" alt="Response when app tries to get elements"></a></p>

<p><a href="https://i.sstatic.net/uYQgK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uYQgK.png" alt="Cookies after it prompts me to re login"></a></p>

CC BY-SA 4.0
2019-08-16T19:36:06.147Z
I'd probably make sure your PHP sessions are properly working first... Craft's identity cookie is based on a working PHP session, so if that's failing it might describe the behavior you're seeing.
Brad Bell
CC BY-SA 4.0
2019-08-19T13:56:39.113Z
Thanks Brad. I do believe I see a cookie being set named PHPSESSID with a long string as the value so i'm going to be guessing it's working but I can double check.
zhua89
<control-panel><cookies><authentication>
Logging into CP doesn't set authentication cookie
# Logging into CP doesn't set authentication cookie

(Asked by: username_0 on 2019-08-15)

Trying to debug an issue where in a dev environment logging into the cp it doesn't set the CP Authentication Cookie (the hash with the \_identity) at the end of it. I believe this is the root cause of why no entries load and any request to the craft api returns a 400 with a response of Forbidden: Login Required.

This is the weird part because I am able to log in initially but after doing so it is as if i'm not logged in and I can only see a few things.

The other thing that happens is after a minute the session expired modal will pop up and after entering my pw again the modal won't go away. Now if I check my cookies I'll see the authentication cookie but it seems to automatically expire after it get set.

[![Response when app tries to get elements](https://i.sstatic.net/Az8uA.png)](https://i.sstatic.net/Az8uA.png)

[![Cookies after it prompts me to re login](https://i.sstatic.net/uYQgK.png)](https://i.sstatic.net/uYQgK.png)

**Tags:** control-panel, cookies, authentication

> **Comments:**
> **username_1**: I'd probably make sure your PHP sessions are properly working first... Craft's identity cookie is based on a working PHP session, so if that's failing it might describe the behavior you're seeing.  
> **username_0**: Thanks Brad. I do believe I see a cookie being set named PHPSESSID with a long string as the value so i'm going to be guessing it's working but I can double check.  

---

## 0 answers

