I have a problem with cookies.
I have a simple (self created) REST API in PHP, running on localhost:80/api.
FrontEnd is React App running localhost:3456.
In PHP the cookie header is:
"Set-Cookie: jwt_refresh_token=".$jwtRefreshToken."; HttpOnly ; Max-Age=3600; Secure; SameSite=None;"
The cookie is actualy send to client, but it is not saved in browser
Recieved cookie, edge
Other PHP headers which are sent to clients:
header('Access-Control-Allow-Origin: http://localhost:3456');
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header('Access-Control-Allow-Headers: Authorization, Access-Control-Allow-Headers, Origin, Content-Type, Access-Control-Request-Headers');
header('Access-Control-Allow-Credentials: true');
What I tried and it didnt help, after reading tons of Questions, answers and tutorials:
- Turn of cookie SECURE param, while its localhost
- Use IP, instad of localhost
- Push API online and use SSL
- Run client app on URL without port, directly on localhost (etc->localhost:80)
PS: Everything is working when testing API in postman -> cookie is automaticly saved in Postmans cookies.
Anyone know, what to do?
Update 1
Response headers
Request headers
Preflight Response
Preflight Request
Update 2 Okay, regarding to other posts - Edge, Chrome (and other chrome core browsers) they dont want to save cookies, on pages which have a port number (As my frontend runs at localhost:3456), tried again localhost(:80) and it works now for FireFox atleast. But still not for chrome core browser