Guest User

Untitled

a guest
Feb 1st, 2019
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. String username = '****@gmail.com';
  2. String password = '***********WwmQ***';
  3. String endPoint = 'https://test.salesforce.com/services/oauth2/token';
  4. String clientid = '****************';
  5. String clientsecret = '****************8';
  6. Http http = new Http();
  7. HttpRequest req = new HttpRequest();
  8. req.setEndpoint(endPoint);
  9. req.setMethod('POST');
  10. req.setHeader('Content-Type','application/json');
  11. req.setBody('grant_type=password'+'&client_id='+clientid+'&client_secret='+clientsecret +'&username='+username+'&password='+password);
  12. HttpResponse res = http.send(req);
  13. System.debug('Body ' + res.getStatusCode());
Add Comment
Please, Sign In to add comment