Laravel backend as API (rota.test), React Frontend (localhost:3000) (seperate from each other)
I create and queue a http only cookie successfully on hitting an authentication route.
Access token / expiration time is returned to the user, and the refresh token is stored in a httponly cookie
protected function setRefreshTokenCookie(string $refreshToken)
{
Cookie::queue(
Cookie::make(
self::$refresh_token_cookie_name,
$refreshToken,
14400, // 10 days
null,
null,
false,
true
)
);
}
I can see see the cookie in the XHR request response http://prntscr.com/smwbez
When I send my user to a refresh-token route, the cookie cannot be retrieved (returns null)
protected function getRefreshTokenCookie()
{
return Cookie::get(self::$refresh_token_cookie_name);
}
I have AddQueuedCookiedToResponse in my API middleware.
EncryptCookies is not in the APi middleware, but have tried adding the cookie name to encryption exceptions anyway (no luck)
Any explanation of why I can't retrieve the cookie?