Skip to content

Instantly share code, notes, and snippets.

@msrivastav13
Last active December 21, 2015 10:19
Show Gist options
  • Save msrivastav13/6291230 to your computer and use it in GitHub Desktop.
Save msrivastav13/6291230 to your computer and use it in GitHub Desktop.
SalesforcetoSalesforceConnectionOauthAutonomousClient
ublic class TestCallout {
public static void TestCallout(){
String clientId = '';
String clientSecret = '';
String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username=username&password=password';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(reqbody);
req.setMethod('POST');
req.setEndpoint('https://data-na3--data.cs13.my.salesforce.com/services/oauth2/token');//Note if my domain is set up use the proper domain name else use login.salesforce.com for prod or developer or test.salesforce.com for sandbox instance
HttpResponse res = h.send(req);
system.debug('--------'+res.getBody());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment