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?