Need HELP with Mobile F7 app login process

Hmmm. That doesn’t happen to me. I set CORS in an array (in the target>app>config>config.json) and never think about it again.

Strange, I’m setting it in the same path, but it’s overwritten every time I reopen the Server project.

It sounds like you’re setting it in the app > config folder not the .wappler > targets > targetName > app > config folder

If you set it in the target folder, it will use that each time it rebuilds the project’s config (when switching targets)

2 Likes

well there you are… after experimenting with multiple Capacitor settings, the final solution was just to use the native Capacitor Http plugin that bypasses all CORS.

It is already built in Capacitor core, so you just have to enable it.

So just edit capacitor.config.json in your project root and add the plugins section as below.

{
  "appId": "com.example.app",
  "appName": "helloworld",
  "webDir": "www",
  "bundledWebRuntime": true,
  "plugins": {
    "CapacitorHttp": {
      "enabled": true
    }
  }
}

That is all! No more CORS options needed!

Will see if we can auto enable that in all capacitor mobile projects.

More info at:

5 Likes

Awesome @George! Is this something that we will need to disable for production environments?

Thanks everybody.
I finally succeed to create app using my login SC and BS5.

I re-try then with a brand new FW7 App with only few things:

  1. a list (to test repeat SC) > OK

  2. a button to test an alert > OK

  3. and the login screen that should submit my (“validated”) Login API > NOK

I followed the how to steps as below Creating a Login Screen for Mobile Apps

And just Added a Log Screen

Then modified the login form into Server Connect Form and setted up my Login API.

Finally added dmx-on:click behavior
Sign In

Nothing happens… The form is not submitted

Also dmx-on:unauthorized=“app.alert(‘NOK !’)” doesn’t oppen th alert.

Any idea? Does it come from dmxFramework7_6.js ?

Thanks

Hi @sylvainbaron, it’s a difficult to understand your issue based on the information you’ve provided.

How are you testing? Is it in a mobile app or in your browser?

Hi,
Testing on Both Browser and App (iOS and Android).
My issue is simple at least:
Adding a dmx-on:click behavior on the Sign-In button from the Login Screen doesn’t work. nothing happens on click.

Check the browser console for errors please.

Hi Teodor,
The Console :

And the page:

Thanks

Make sure you are using the latest version of the file Patrick already posted to you in one of your other topics:

thanks @Teodor.
Just did it.
Once done do I need to accept the Update process?

No, as this will replace the file with the old one.

1 Like

this explain why i did not succeed previously… many thanks

Just to explain here as well, by using the Capacitor Http module you are not disabling any security, just CORS checks - those are also not performed in your browser if you call the url directly.

All security provider and other restrictions stay in place.

So it is all save to be used in production as well.

Has anyone had issues with SC forms when enabling this plugin?

I get the following in Safari (using iOS Simulator) when submitting a SC form:
The first console error is when I submit the form using a Submit button for the first time. The second is if I click the same button again afterwards.

@sylvainbaron, @kfawcett,
Have either of you tried using a Server Connect form in Capacitor after the HTTP plugin was enabled?

If not, would you mind trying one to see if you get the same as me? I’d love to know if it is just my project or a wider compatibility with SC forms and the plugin.

Well there might be a bug in the capacitor http plugin. See https://github.com/capacitor-community/http/issues/136

But we have also improved our CORS settings now, so giving origin of * or specific multiple mobile origins will work all fine. So you don’t really need the Capacitor http plugin any more.

1 Like

I haven’t noticed any errors on Chrome in Windows, Android, or Electron.