Using a public client to communicate with a confidential client

I have a app where a user logs in via the UI and this is linked to a public client in Keycloak. Then when the user interacts with the dashboard, api calls are sent to the backend which is a confidential client, but the response is always a 401 response.
I am trying to achieve what is being done in this tutorial.
But yes I want to be able to use the public client UI to be able to communicate with the confidential backend. How can I achieve this?
I asked a more detailed question in StackOverflow if you want to read more on how I have my project setup