I'm developing the salesforce app using salesforce LWC components, I have requirement where I should process the salesforce data from an external system, for this I'm sending the data to the external api, say 'https://myapi.com/contact', but when I render the app, I'm getting an error as unauthorized access, so I setup my api url in the remote site settings, since my app will be downloaded and used by any salesforce user, It's not possible to set this manually, is there a way I can set the remote site settings programmatically when my app is installed or is there any other way I can solve this without any user intervention
How are you distributing your app? Can't you just add the remote site to your managed package?
If not - you could add some "setup guide" VF page (lwc won't work because it doesn't generate api-enabled session IDs) and do a trick similar to https://andyinthecloud.com/2014/07/29/post-install-apex-metadata-api-configuration-solved/