Login/Logout/Redirect not working as expected in node.js project when using Server Actions

Wappler Version: 6.0.0 with Beta channel and experimental features
Operating System: Windows 11
Server Model: Node.js
Database Type: Postgres
Hosting Type: Docker

Expected behavior

My app should redirect the user to another page after logging in, logging out, or being unauthorized.

Actual behavior

When using a Redirect step or Security Restrict Login URL in a Server Action the page is not changed.

You can see in the Network tab that a 302 Redirect is issued, but the page does not change.

image

NOTE: If I use a Browser goto on the Server Connect on the page instead of a Redirect step or Security Restrict Login, the page will properly change.

How to reproduce

Try to use redirects in Server Actions.

I found a way forward, although it’s not intuitive in the UI. I had to add the Server Connect with the Security Restrict to each of the Layout pages in my app in the “Server Side Data Server Connect” property.

Do note that Server Actions do redirects only within their own action, so they will never redirect your whole page, you will need a browser goto for that that you are usually adding on the server connect event on the page for example on unauthorised

Not sure I’m following. The Server Connect’s Security Restrict does redirect the entire page when you add it to the App component.

The redirect step in server action will only redirect the server action, not the front end using it. So you can see the redirect happening in the Network > XHR tab, but on the page itself.
If you want to redirect users on the front end, you need to use the browser goto action.

What would be the use case for the redirect step? I’m not understanding how a redirect action would do anything other than make the page the user is on change.

Redirect step is used for example with Oauth2 for redirecting users after authorization.

Wouldn’t that still trigger a change on the client or are you saying server-to-server oauth?

You call the oaut2 action directly (href=“action”) not using ajax (dmx-on:click=“action”) so the redirect step makes sense there.