Cookie not set on Cordova app (iOS and Android)

837 views Asked by At

I develop applications using Cordova and utilize the cordova-plugin-inappbrowser to open a local index.html file, which in turn displays a website within the app.

window.location='https://example.com/index.cfm?app_token='+token+'&model='+device.model+'&platform='+device.platform+'&manufacturer='+device.manufacturer+'&version='+device.version;

Users has to login on example.com. To enable the "Save login" functionality on example.com, I use Lucee to set a cookie programmatically. This cookie is used to store the user's login credentials securely, so when they visit the website again, they are automatically logged in without having to enter their credentials repeatedly.

<cfcookie samesite="strict"
            name="RememberMe"
            value="#strRememberMe#"
            expires="never"
            httponly="true" secure="true"
            />

Users are complaining that they have to login again, so the cookie is not set I presume. So I use this method for 4 years and created 40 apps like this. In the beginning some user complained about have to login again. But on my latest app a lot of users have to login daily.

I use:

What I have tried so far:

  • set the samesite to "none"
  • cordova cli version 11.x
  • The cookie is saved and the functionality is working on normal webbrowsers (Chrome, Safari, ect).

Request:

  • Does someone knows how to debug this problem. I think the cookie is not set (not sure).
  • Someone knows how to fix this, or got some tips to address this issue?
1

There are 1 answers

0
Eric On

The webview is served with https so your cookie cannot be set as httponly="true"