3
votes

We are trying to build an external application/Connected App over Salesforce and are using OAuth 2.0 Webserver flow to retrieve the access tokens and refresh tokens. We created the callback uri with the localhost uri path and this works fine for us.

However, in production we have multiple instances with different hostnames and they will each need a callback uri to be registered. There will many such instances that may be auto created dynamically and we won't know ahead of time what the hostnames will be. Also, adding a callback uri for every instance doesn't seem like a scalable solution for us.

Is there a way to create a dynamic callback URI for Connected Apps? Or any other mechanism that will help us retrieve the access token and other OAuth details?

1

1 Answers

1
votes

I don't think it is possible to dynamically change callback URI of the connected App (my guess this is done for security reasons).

Speaking of alternative routes - first thing that comes into my mind is adding a layer between salesforce and your server instances to act as a gateway. For example, you can use particular server to authenticate to salesforce and retrieve session id, and then via some internal API share this information with other instances.