php - What is the best practice to access cookies from postman?

below is my code to set cookies
$expireTime = time() + 3600;
$tokenPayload = [
'user_id' => $token->getUser()->getId(),
'email' => $token->getUser()->getEmail(),
'exp' => $expireTime
];
$jwt = JWT::encode($tokenPayload, getenv("JWT_SECRET"));
$useHttps = true;
setcookie("jwt", $jwt, $expireTime, "/", "", $useHttps, true);
And it set perfectly as image below
but when i try access that cookie it return null by below code
return $request->cookies->get("jwt") ? true : false
I am trying to access cookie in symfony code to authenticate.
Answer
Solution:
I am answering my own question when you are working on local you have to send $useHttps as false to set cookie
//$useHttps = true;
$useHttps = false;
setcookie("jwt", $jwt, $expireTime, "/", "", $useHttps, true);
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: malformed utf-8 characters, possibly incorrectly encoded
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.