I have tried following the Docs for creating a login flow but they use databases instead of APIs.
So I created my own API flow that sends the input from the login page onto the oauth/api server and receives a JWT token.
It authenticates correctly and I store it on a session cookie, however the browser redirects to the API response page instead of staying on the form.
How can I fix it and how to dynamically navigate to a new page based on the return message (success or not authorised?)
I have tried adding a browser element and controlling the navigation through the dynamic events as per the pic below but the form still shows me the API response instead of either staying on the login page or navigating to the user dashboard.