I have to connect two different sales force org am getting error for 400 and 302 and bad request. Where do I get refresh token, Please can you give suggestion what correction should I do?
httprequest hreq=new httprequest(); //string
refresh_url='https://login.salesforce.com/services/oauth2/token?grant_type=refresh_token&client_id=3MVG9Y6d_Btp4xp7AyV8b3ouuXI_CkGlTRIJLDmriyEpT59eoFmWPZBwjZmoI8Raq3cRrYzFZ.Oa9ZpBayp87&client_secret=3678419209862860540&refresh_token=0Ak900000GcOb09';
string
refresh_url='https://login.salesforce.com/services/oauth2/authorize?response_type=token+id_token&client_id=3MVG9Y6d_Btp4xp7AyV8b3ouuXI_CkGlTRIJLDmriyEpT59eoFmWPZBwjZmoI8Raq3cRrYzFZ.Oa9ZpBayp87&redirect_uri=https://login.salesforce.com/services/oauth2/success';
system.debug('------------refresh_url------------'+refresh_url); hreq.Setendpoint(refresh_url); hreq.setmethod('POST');
hreq.setHeader('Accept',
'application/application/x-www-form-urlencoded;charset=UTF-8');
hreq.setHeader('Host','ap1.salesforce.com'); http htp=new http();
httpResponse res=htp.send(hreq);
System.debug('-----------------FutureRefreshToken_ID------------------'
+res.getBody()); //string result=readXMLResponseOfFutureAccessToken(res.getBody());