Electron: How to secure pages and run API actions with security provider?

I currently already have a fully functioning site built with Wappler in PHP with all the server actions I need, etc. The site can only be accessed if you log in. Pages are protected using Wappler’s security provider enforcer.

I want to make a desktop application for this site, using the existing server actions, but I do not see a way to implement a security provider enforcer in Wapplers Electron integration to prevent accessing other pages in a desktop app if you are not logged in or do not have the correct permissions. What’s the best way of going about this?

Hi @Digo,
Quite simple. Have a simple user profile Action (for example) on each of your pages, in the Server Connect Action for this profile set Steps for Security Provider and Security Restrict above the query for the user profile, have a Condition to check that the user profile id (or whatever you set for the Security column) is equal to that of the Security Provider Identity. Attach a Dynamic event to the user profile Action you created for Unauthorised and set a Browser goto index/login page if Unauthorised. That way if a user is not logged in they will be dumped back to login… Nothing too complicated.

1 Like

Aha! Interesting approach, I hadn’t thought of that. Thanks!

1 Like