Keycloak and expressjs downloading

Hello all,

I’m new using Keycloak and I have a problem when trying to create a function for a web client user to download I file from the server.

I’m using expressjs'/saveMessage', keycloak.protect('AdminGroup'), (req,res) => {;

When the client clicks on the download button in the webgui I get

Could not obtain grant code: Error: 400:Bad Request

anyone know what can be the issue?

thanks all,