We have developed AppExchnage app and is used connected app to integrate 3rd party system with SFDC. This app worked great till one of our customer have asked to install it on their sandbox. 3rd party was just able to connected with SFDC.
When we dig into oAuth flow we found that its issue of & My Domain.
So here is what is happening:
1) From 3rd party app user click connect to SFDC
2) We redirect user to https://test.salesforce.com/services/oauth2/authorize?&response_type=code&client_id=xxxxxxxxxxxxxx&redirect_uri=xxxxxxxxx
3) then it redirects to https://MyDomainxxxxxxxx.cs7.my.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source=xxxxxxxxxxxxxx
4)then it should come back to call back URL but goes to https://test.salesforce.com/
When we tried same thing with https://login.salesforce.com/ it just worked fine.
So here is my question: is it a sandbox specific bug ? or Am i missing something?
PS: we have not disabled login from https://test.salesforce.com/ on our My Domain setting.