0

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

R_M_R
  • 31
  • 6

1 Answers1

0

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/

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Thanks for the answer, I will be pushing the app to salesforce AppExchange, may I know how can I add the remote site within my package, I found from the docs, I have to set remote site from the salesforce application. – R_M_R Apr 15 '23 at 17:31
  • Sign up for your own free Salesforce Developer Edition (has most "toys", features but limited storage space), that's the only way to create a managed package. Have you seen https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_intro.htm ? – eyescream Apr 15 '23 at 17:39