[SalesForce] REST API server-to-server communication

I'm writing an application that needs to connect and grab some data from Salesforce. Data will be pulled by a background script (no UI) and then populated in a web UI.

I can't find anything explaining how authentication can be achieved in this specific scenario when I don't have any login/pass flow, meaning the oauth2 grant_type=password is totally inadequate in this case.

Since my script will work in background, a grant_type=client_credentials could work, an API key as well …

Can someone please point me in the right direction?

Thanks.

Best Answer

I would rather use the OAuth 2.0 JWT Bearer Token Flow.

The only prerequisite is to have on both servers the same certificate for:

  • at your server side, sign the request using the private key of the certificate
  • salesforces to verify that you are the one who signed the request.

They give a code sample to sign the request.

Related Topic