Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Session can not be saved

$
0
0

From one function I am setting a session and from another function, I would like to get the value of that session.

// Set the session
public function setSession($data) {
    $this->get('session')->set('id', $this->loginDao->getId($data['email']));
    return true;
}
// Get the session
public function getSession() {
    return new Response(json_encode($this->get('session')->get('id')));
}

My problem is that getSession returns null.

I have tested it with Postman and that works! What I have realized is that Postman has PHPSESSID=1a2714euatml19jj4p1rq9sbsa as Cookie in header but in Chrome it's missing.

This is how the header looks like in Chrome:

enter image description here

Correct me if I am wrong, but I guess Set-Cookie is missing here.

However, what is the reason that it works in Postman but not in the browser? And how can I fix this?


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>