Home » Php » php – Gonative.io app won't allow cookie update

php – Gonative.io app won't allow cookie update

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’ve wrapped a web application into a native format using gonative.io…the app is working great, but i can’t update cookies.

The original cookie sets appropriately (and keeps the user logged in). But if I try to update the cookie in the underlying web application, the cookie value remains unchanged.

Here are the parameters i’m using to set the cookie in php:

$sa = serialize($_SESSION);
$sab64 = base64_encode($sa);
$sab64E = $view->encryptString($sab64);
setcookie(APP_COOKIE_NAME, $sab64E, time() + 31536000, '/');

I have checked the gonative documentation for keeping users logged in, but it only says “use persistent cookies”.

How can I update the cookie?

How to&Answers:

The cookie can’t be over 4k.

I was able to reduce the cookie size by removing session parameters that don’t need to be stored for reuse and can be regenerated upon a new login. This appears to be related to the maximum cookie size of safari which is probably what gonative uses under the hood to do the browsing of the app that is wrapped.

Using a cookie that was only 2.3k, i was able to update the cookies in gonative.