I've played with JSON.serialize() & .deserialize() to pack & unpack data that I will be sending to a 3rd party (PureCloud). We have an existing integration with Twilio to send & receive SMS, but their integration has a static token stored in a Custom Setting in Salesforce, vs. the ClientId/ClientSecret to request a token with each request.

The Apex Connector example for google (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connector_example_google_drive.htm) looks like what I should be working from to actually authenticate, but I can't find an example of the DataSource.ConnectionParams being created/initialized.

I've created a Custom Setting to store the ClientId & ClientSecret -- can someone point me to an example where that DataSource record is populated?



If you're wanting to create an OAuth connection for a custom OData connector, I think you want to be looking at the following Help Page: Define an External Data Source for Salesforce Connect—Custom Adapter. It includes links to other documentation with directions on how to configure the OAuth settings. There's also some related information in the Apex docs under Set Up Salesforce Connect to Use Your Custom Adapter.

I'm currently writing an https service myself to authenticate with another service by passing a JWT Bearer token. I have to manually generate the token since it's going outbound instead of coming inbound. If it were inbound and/or Salesforce was serving as the idP, I could configure a connected app to handle everything in the OAuth for me; making it all much easier.

If you're handling all of the authentication yourself, I think you'll want to read Authentication for Salesforce Connect Custom Adapters and look at the Auth Namespace. Those methods are the ones that will be applicable to what it is that you're doing.


It looks like I have both parts now - the JSON object for the data, and HttpRequest for the connection - here's a thread from April that addresses this: Oauth process for PureCloud/Genesys... (and yes, it's a previous question of mine -- can I help it if this project has a 'dynamic priority profile'?!?)

Thanks for your help -- I'll come back & post a follow-up that combines the two into something useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.