Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String username = '****@gmail.com';
- String password = '***********WwmQ***';
- String endPoint = 'https://test.salesforce.com/services/oauth2/token';
- String clientid = '****************';
- String clientsecret = '****************8';
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- req.setEndpoint(endPoint);
- req.setMethod('POST');
- req.setHeader('Content-Type','application/json');
- req.setBody('grant_type=password'+'&client_id='+clientid+'&client_secret='+clientsecret +'&username='+username+'&password='+password);
- HttpResponse res = http.send(req);
- System.debug('Body ' + res.getStatusCode());
Add Comment
Please, Sign In to add comment