function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sonal4JSonal4J 

Unable to connect to target salesforce organization on same instance using OAuthConnection

Exact replication steps:
1. Create a connected app
2. Add the callback URL to that connected app as the URL of a VF page. For Eg - 'https://c.eu2.visual.force.com/apex/mypage'.
3. Connect to another salesforce org of the same instance.Énter the login details ie username and password
4. Allow permission to the connected app create on your source org to access info about target org by clicking on Állow Button'
5. Instead of redirecting back to source org it redirects me to the target org and tries to open up the page mentioned in the callback url.
6. This issue is coming when my source and target org are on same instance. It works fine when source and target instances are different.
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help u

https://developer.salesforce.com/page/Connected_Apps
https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm&language=en_US (https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm&language=en_US)

Please let us know if this will help u 

Thanks
Sonal4JSonal4J
The issue is not setting up a connected app. It is when the source and target org are on same instance