Most examples of implementing a callout as part of a LWC involve calling an Apex method that handles the callout and returns the response to the JS controller. What are the reasons we callout from Apex, rather than handling the HTTP request client-side?
I'm thinking of a couple reasons but would like to check my understanding.
- Calling from client side would expose the headers in the network request from the Network browser inspection tab.
- If we pull our credentials from a metadata record in Salesforce setup, we then expose these directly in the client. (But isn't the file minified and obscured in a production environment?)
Am I understanding these correctly? And what are some other reasons?