Http Plugin Capacitor, some questions

It looks to me there is something wrong with the http plugin. The plugin patches the fetch and xmlhttprequest in the webview.

The http plugin allows you to use the native libraries for http connections which aren't restricted by the webview. The advantage is that it can bypass any CORS or other security restrictions. If you have setup CORS correctly on your server it is not needed to use the http plugin.

Thanks @patrick, but this is about cookies rather than cors.
Specially when working on iOS.

Cookies are stored if

 "server": {
    "hostname": "mydomain.com"
  },

But that doesn't work very well on iOS, so trying to use http for this, with localhost and cookies manager:

2024-07-16 22:04:15.812  1341-1662  CapacitorCookies        com.httpbs.app                       I  Setting cookie 'mobiletest=6e%2FCZ4TFDpDCNpvDmldGuR2c2rGBNMTE9Lxal3MY22QPC5uRRobKko3Clygt8uf0; Expires=Friday, 26-May-2034 01:04:15 GMT; Path=/; Secure; HttpOnly;SameSite=None' at: 'http://localhost'

Hey @franse thought I'd try something. New Project, all the basics (for Android), no plugins (no cookie plugin or http plugin), Server Actions and Security Provider/Login added. All works fine out of the box. No other configurations aside from correct CORS permissions on the remote host side.

Thanks @Cheese , are you totally sure cookies are stored and no need to re-login every time the app closes?

As far as I can tell all seems just fine (the identity is matched from Security Provider for the User profile query). We are dropping cookies and adding tokens stored against the User with an expiry period. I'd highly suggest moving on from cookies and not allowing them to halt progress any further. This is by far the most sensible approach for longevity, security, and future-proofing the application.

It is also cross-platform resilient. Doesn't matter what OS is running on the device. In this regard it makes total and utter sense to adopt this approach sooner rather than later for all mobile development within Wappler.

Yes, I thought on change and start using token.
In my case cookies are being stored on android with cookies plugin.
On iOS need to use http plugin but that breakes everything on Android as you can see from all my posts.
Maybe I need to put and end to this, I'll never know what is happening here.

Btw:

What a nice line :slight_smile:

There are some many things I'ld like to be introduced on Wappler that could simplify creating apps, but the truth is I'm really happy on what the team has already done for it. Can't ask for more.

Token based is really what we would like to see. If not using Passport (Patrick explained in his response) then by another Wappler accepted methodology. Maybe a Security Provider option for mobile? Either way we are going to jump the gun and drop cookies now. We can always move on to the Wappler way when it is available. There is no need to rely on cookies for anything whatsoever within mobile development. The sooner this is implemented the better it will be and open the doors for everyone to build mobile applications with ease and without confusion.

Me too, I am happy to say. BUT for new to mobile Users... It is a hurdle to overcome, and can be off-putting to say the least. We are 'seasoned' so we work around it understanding what Wappler can do (flexibility wise), others may not have the benefit of hindsight or experience though.

Yes, it's really a challenge, but everything seems to be simplified little by little.
What really crush me, it's not about Wappler itself, but gradle/jdk - swift/appkit versions which seems to be the brake for every new app.
Several backups of those files, don't wanna try to change anything. Scared.
Imagine a world where those tools are fully installed and synced on a Wappler popup?
Everyone would walk happily down the street! :grinning:

Thanks for sticking with me on this, and of course the advices, really appreaciate learn something new!

Time to grab more coffee.

1 Like

For me it has a funny irony. I don't own a Smartphone nor use Android or IOS. I actually have a Nokia 100 as my personal phone. So these are applications I'll never use. I do have to laugh.

I feel your pain. I'm in the habit of backing up every time I make a change to any Project. I've already broken Wappler's 'Run' ability after making several changes and have to use Android Studio but I do tend to use this more often than not anyway so no real harm done. It is so much faster and I have little patience for waiting for something to open/run/deploy (funny as can do the same thing 300 hundred times and not think about it).

I'm not sure that is possible but a nice and considerate thought none the less!

Like I said we all need help and a sanity check now and again. Me definitely when it comes to sanity as I'm usually well away from reality more often than not. A head full of if or else, on and off, zeros and ones... Loop and repeat until I have a buffer overrun and crash!

:smiley:

Sat here at 2.08am with a fresh pot myself after finishing the token side off finally. Am a lot happier now as will at least slow my head down when its time for it to rest on the pillow.

:sleeping:

Same time same place tomorrow?

:rofl:

1 Like