Authenticating Salesforce REST API calls to custom Apex endpoints

Posted: December 11, 2015  |  Categories: BizTalk Uncategorized

Seroter has shown us how to call the REST API from BizTalk Server and we used this to successfully call standard objects like”>https://<blah> We could not use this to call custom objects like”>https://<blah> unless we modified the published WCF Behaviour for authentication. Thanks to Aravindh Kathiresan for working all this out. The purpose of this blog is to share how we modified this behaviour and as a memory dump for me.

We started from code shared by Muhummad Ehsan. The login endpoint is hard coded to when calling the REST API authentication service. We had to change this to”>https://<blah> . First we changed this line of code in SfdcTokenManager.cs to dynamically assign the login endpoint.


Secondly we added a new oauthurl configuration property

and changed the return signatures to


The OAuthURL was added to the struct in the  RestAuthConfiguration.cs.


Finally the SfdcRestAuthBehavior.cs was refactored to include the OAuthURL.


After deploying the modified behaviour an authentication endpoint can be configured on the endpoint behaviour as shown below;


In summary we have shown how to dynamically configure a Salesforce authentication endpoint in a custom endpoint behaviour. This can be used to call a REST API with a custom Apex endpoint.


Back to Top