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

1 Answer 1

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/

Sign up to request clarification or add additional context in comments.

2 Comments

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.
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 developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/… ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.