When a new tenant is created in Cumulocity, the default login mode is set to OAI Secure, and the “Forbidden for web browsers” toggle is enabled. Consequently, our custom application encounters a 403 Forbidden error while attempting to fetch data. According to the documentation (Basic settings - Cumulocity documentation), it is necessary to include an additional User-Agent header in the request. Could you please provide a sample code to demonstrate how to accomplish this?
I guess you are misinterpreting the documentation. Your web browser will automatically add the User-Agent header to every request, that it sends. There is no option to change the User-Agent header that is added by your browser within e.g. your javascript code.
You could add the user agents sent by your browsers to the trusted user agents here: