Is it possible to integrate Salesforce to Salesforce using Oauth Webserver flow?

I cannot use the standard S2S(Salesforce to Salesforce) feature due to certain limitation.

I basically sync data from many Orgs to a single master data Org from where the update can be broadcasted to the connected orgs. I'm using web services from either side to do the communication.

I'm not sure of the oauth authentications(web server flow) that needs to be done in order to communicate through web services. I'm sceptical about saving the Master Org credentials in the connected orgs since that might be potentially insecure(username, password flow).

Tried out the web server flow in Oauth and I met with some return URL not being set properly because both the applications are in the same domain(login.salesforce.com).

Any design suggestion for the Oauth authentications would help! Thanks in advance!

1 Answer 1


Yes - you can absolutely do this. Use the 'Salesforce' authentication provider to provide login from a 'source' org to a 'target' org, and, in the target org, you can access an access token to call APIs back in the 'source' org.

This is how FinancialForce run their customer support portal. There was a session covering this at Dreamforce 2012, and Stephen Willcock of FF wrote a follow-up article on it. Although the article covers customer portal, the approach carries over to Salesforce Communities.

  • I tried configuring the connected App and the Auth provider. Unfortunaltely, I get the "error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration" error. The callback URL of the connected App and the Auth Provider matches. And just for confirmation, I've created the Connected App and the Auth Provider in the same developer Org. Also, I've used Communities as you have pointed it out instead of portals and hence the community is not linked in the Auth Provider as how the Portal is linked in the example. Sep 22, 2014 at 6:42
  • Weird - all I can suggest is to double check the URLs.
    – metadaddy
    Sep 22, 2014 at 16:45
  • Should the connected app and the auth provider be in the same Org? Is that fine? Sep 22, 2014 at 16:50
  • They can be, but typically they are not.
    – metadaddy
    Sep 22, 2014 at 17:03
  • 1
    Test it with two separate orgs (one 'source', one 'target') and make sure you have 'My Domain' set on at least one of the orgs, otherwise you'll likely get instance collisions (cookies overwritten) if they are both on, for example, na17.
    – metadaddy
    Sep 22, 2014 at 18:38

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.